I have bought my SSL secure certificate and successfully installed on Tomcat with the keytool but how do my redirect the entire site to go HTTPS and redirect any HTTP connection straight over to HTTPS.

I need to edit the 2 Tomcat configuration files; server.xml and web.xml and then when edited restart the tomcat service.

Open server.xml typically found in tomcat/conf and change:

Connector port="80?
enableLookups="false"
redirectPort="8443?

to

Connector port="80?
enableLookups="false"
redirectPort="443?

Then open web.xml (same directory) and add this snippet before the closing tag of /web-app:

<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Context</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<!-- auth-constraint goes here if you requre authentication -->
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

Restart Tomcat and all pages should redirect to https.

Redirect HTTP to HTTPS on Tomcat的更多相关文章

  1. Apache 配置Https 转发Tomcat Http

    Apache 相对于nginx的配置对比起来相当复杂啦,朋友之前的系统使用的是Apache需要增加一个虚拟主机,主要配置从Apache转发Tomcat. 首先需要拆解下步骤: Apache 支持Htt ...

  2. 指定页面配置https(apache/tomcat)

    apache/tomcat服务器下配置https         apache下配置https:             首先在网站根目录下,找到.htaccess文件(如果没有则新建),apache ...

  3. Docker(十一):Docker实战部署HTTPS的Tomcat站点

    1.选择基础镜像  docker pull tomcat:7.0-jre8 2.生成HTTPS证书 keytool -genkey -alias tomcat -keyalg RSA -keystor ...

  4. Springboot 配置 ssl 实现HTTPS 请求 & Tomcat配置SSL支持https请求

    SSL(Secure Sockets Layer 安全套接层),及其继任者传输层安全(Transport Layer Security,TLS)是为网络通信提供安全及数据完整性的一种安全协议.TLS与 ...

  5. HTTP redirect 重定向到 HTTPS

    最近帮一个顾客做网站,  需要HTTPS. 之前接触的SSL certificate直接上传到plesk 上面勾选重定向即可. 在此先吐槽下godaddy 服务贵功能还少. 用代码从HTTP来重定向到 ...

  6. Tomcat服务器配置https协议(Tomcat HTTPS/SSL 配置)

    通常商用服务器使用https协议需要申请SSL证书,证书都是收费的,价格有贵的有便宜的.它们的区别是发行证书的机构不同,贵的证书机构更权威,证书被浏览器否决的几率更小. 非商业版本可以通过keytoo ...

  7. Nginx + 阿里云SSL + tomcat 实现https访问代理

    第一步:阿里云申请云盾证书服务 第二步:下载证书 第三步:修改Nginx配置 1. 证书文件214033834890360.pem,包含两段内容,请不要删除任何一段内容. 2. 如果是证书系统创建的C ...

  8. nginx 代理https后,应用redirect https变成http --转

    原文地址:http://blog.sina.com.cn/s/blog_56d8ea900101hlhv.html 情况说明nginx配置https,tomcat正常http接受nginx转发.ngi ...

  9. Centos下搭建 tomcat https服务器详解(原创)

    一 .安装java jdk配置环境变量 1. 卸载原有openjdk yum -y remove java-1.7.0-openjdk* yum -y remove tzdata-java.noarc ...

随机推荐

  1. Hibernate缓存机制

    缓存是介于应用程序和物理数据源之间,其作用是为了降低应用程序对物理数据源访问的频次,从而提高了应用的运行性能.缓存内的数据是对物理数据源中的数据的复制,应用程序在运行时从缓存读写数据,在特定的时刻或事 ...

  2. AngularJS理论基础

    AngularJS理论基础 AngularJs是一个用于设计动态web应用的结构框架. 它是一个框架,不是类库,是像EXT一样提供一整套方案用于设计web应用.它不仅仅是一个javascript框架, ...

  3. ocument的createDocumentFragment()方法

    在<javascript高级程序设计>一书的6.3.5:创建和操作节点一节中,介绍了几种动态创建html节点的方法,其中有以下几种常见方法: · crateAttribute(name): ...

  4. java.lang.ThreadGroup.enumerate

    java.lang.ThreadGroup.enumerate(Thread[] list) 方法复制该线程组及其子组中的所有活动线程到指定的数组. 声明 以下是java.lang.ThreadGro ...

  5. uva 1210

    #include<iostream> #include<cstring> using namespace std; + ; bool notprime[MAXN];//值为fa ...

  6. EasyMock的原理及使用方法

    就不费劲转过来了https://www.ibm.com/developerworks/cn/opensource/os-cn-easymock/这上面介绍的比较全.

  7. Mac OS X 卸载MySQL

    sudo rm /usr/local/mysqlsudo rm -rf /usr/local/mysql*sudo rm -rf /Library/StartupItems/MySQLCOMsudo ...

  8. java基础之类与继承 详解

    Java:类与继承 对于面向对象的程序设计语言来说,类毫无疑问是其最重要的基础.抽象.封装.继承.多态这四大特性都离不开类,只有存在类,才能体现面向对象编程的特点,今天我们就来了解一些类与继承的相关知 ...

  9. 【转】 JAR、WAR、EAR的使用和区别

    Jar.war.EAR.在文件结构上,三者并没有什么不同,它们都采用zip或jar档案文件压缩格式.但是它们的使用目的有所区别: Jar文件(扩展名为. Jar,Java Application Ar ...

  10. PC客户端测试总结

    1.1界面显示内容的检查l 完整性(1显示时应考虑数据显示宽度的自适应或自动换行(数据长度较长).(2所数据展现的界面(如查询等),必须使测试数据的记录数超过一页,以验证满页时其窗体是否有横向.纵向滚 ...