Redirect HTTP to HTTPS on Tomcat
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的更多相关文章
- Apache 配置Https 转发Tomcat Http
Apache 相对于nginx的配置对比起来相当复杂啦,朋友之前的系统使用的是Apache需要增加一个虚拟主机,主要配置从Apache转发Tomcat. 首先需要拆解下步骤: Apache 支持Htt ...
- 指定页面配置https(apache/tomcat)
apache/tomcat服务器下配置https apache下配置https: 首先在网站根目录下,找到.htaccess文件(如果没有则新建),apache ...
- Docker(十一):Docker实战部署HTTPS的Tomcat站点
1.选择基础镜像 docker pull tomcat:7.0-jre8 2.生成HTTPS证书 keytool -genkey -alias tomcat -keyalg RSA -keystor ...
- Springboot 配置 ssl 实现HTTPS 请求 & Tomcat配置SSL支持https请求
SSL(Secure Sockets Layer 安全套接层),及其继任者传输层安全(Transport Layer Security,TLS)是为网络通信提供安全及数据完整性的一种安全协议.TLS与 ...
- HTTP redirect 重定向到 HTTPS
最近帮一个顾客做网站, 需要HTTPS. 之前接触的SSL certificate直接上传到plesk 上面勾选重定向即可. 在此先吐槽下godaddy 服务贵功能还少. 用代码从HTTP来重定向到 ...
- Tomcat服务器配置https协议(Tomcat HTTPS/SSL 配置)
通常商用服务器使用https协议需要申请SSL证书,证书都是收费的,价格有贵的有便宜的.它们的区别是发行证书的机构不同,贵的证书机构更权威,证书被浏览器否决的几率更小. 非商业版本可以通过keytoo ...
- Nginx + 阿里云SSL + tomcat 实现https访问代理
第一步:阿里云申请云盾证书服务 第二步:下载证书 第三步:修改Nginx配置 1. 证书文件214033834890360.pem,包含两段内容,请不要删除任何一段内容. 2. 如果是证书系统创建的C ...
- nginx 代理https后,应用redirect https变成http --转
原文地址:http://blog.sina.com.cn/s/blog_56d8ea900101hlhv.html 情况说明nginx配置https,tomcat正常http接受nginx转发.ngi ...
- Centos下搭建 tomcat https服务器详解(原创)
一 .安装java jdk配置环境变量 1. 卸载原有openjdk yum -y remove java-1.7.0-openjdk* yum -y remove tzdata-java.noarc ...
随机推荐
- nyoj-----284坦克大战(带权值的图搜索)
坦克大战 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 Many of us had played the game "Battle city" ...
- Merge k Sorted Lists [LeetCode]
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. S ...
- 50 个最棒的 jQuery 日历插件,很齐全了!(转)
http://www.php100.com/html/it/qianduan/2015/0326/8856.html 什么介绍都没有,直接上酸菜! 1. Even Touch Calendar 2. ...
- Java 集合系列 05 Vector详细介绍(源码解析)和使用示例
java 集合系列目录: Java 集合系列 01 总体框架 Java 集合系列 02 Collection架构 Java 集合系列 03 ArrayList详细介绍(源码解析)和使用示例 Java ...
- Testin
http://www.testin.cn/ http://news.ccidnet.com/art/66/20150416/5815927_1.html 百度百科上面的 Testin是全球最大的移 ...
- UESTC 2016 Summer Training #1 Div.2
最近意志力好飘摇..不知道坚不坚持得下去.. 这么弱还瞎纠结...可以滚了.. 水题都不会做.. LCS (A) 水 LCS (B) 没有看题 Gym 100989C 水 1D Cafeteria ( ...
- cisco nat
1.配置端口: int s0/0 ip nat outside ;s0/0为外部端口 int f0/0 ip nat inside ...
- PMP 项目管理
1.什么是项目管理 项目管理就是把各种知识,技能,工具,技术应用于项目活动,来满足项目的需求.这个是从技术方面来说的.其实在项目管理的技术 层面背后,还有理念层面的内容.学习项目管理,除了学习技术 ...
- shell学习记录001-知识点储备
1.BASH(bourne again shell ) cmd1 ;cmd2等同于 cmd1 cmd2 2.echo music; 中的分号不被打印出,因为分号默认为命令定界符号 3.利用pgrep找 ...
- 理解squid的正向和反向代理
1.相同点: 访问的走向都是:客户端 -> 代理服务器 ->真实服务器 ->代理服务器->客户端 2.不同点:正向代理语义上更侧重于,让代理服务器去帮忙请求某个网址.让代理服务 ...