指定页面配置https(apache/tomcat)
apache/tomcat服务器下配置https
举例说明:
# http-->https
RewriteCond %{SERVER_PORT} !^443$
RewriteCond%{REQUEST_URI}%{QUERY_STRING}^(/user.php?act=login|/user.php?act=register|/user.php? act=profile)$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
当访问www.xxxx.cn/user.php?act=login的时候,.htaccess文件先判断一下端口号是否不是443(RewriteCond % {SERVER_PORT} !^443$),再判断URL的路径中是否包含了user.php?act=login(RewriteCond% {REQUEST_URI}%{QUERY_STRING}^(/user.php?act=login|/user.php?act=register|/user.php?
act=profile)$),如果两个条件都符合,则执行下一步,跳转到 https://www.xxxx.cn/user.phpact=login (RewriteRule ^.*$ https://% {SERVER_NAME}%{REQUEST_URI}
[L,R])。(https-->http也是同理)
>http)。
<span style="font-size:18px;"> <security-constraint>
<web-resource-collection >
<web-resource-name >SSL</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection> <user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint></span>
第二种:1、下载urlrewritefilter.jar(点击下载),导入项目中。
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
3、在项目目录下创建urlrewrite.xml文件,内容如下。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
"http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
<urlrewrite>
<rule>
<condition type="scheme" operator="notequal">https</condition>
<condition name="host" operator="equal">localhost</condition>
<condition type="port" name="port" operator="equal">8888</condition>
<condition type="query-string" operator="equal">^model=.*&ObjectName=.*$</condition>
<from>^(/servlet/MobileServlet)$</from>
<to type="permanent-redirect">https://%{host}:8443%{request-uri}?%{query-string}</to>
</rule>
</urlrewrite>
指定页面配置https(apache/tomcat)的更多相关文章
- Apache 配置Https 转发Tomcat Http
Apache 相对于nginx的配置对比起来相当复杂啦,朋友之前的系统使用的是Apache需要增加一个虚拟主机,主要配置从Apache转发Tomcat. 首先需要拆解下步骤: Apache 支持Htt ...
- tomcat配置https–采用JDK自带的keytool工具生成证书
转自:http://blog.csdn.net/huangxinyu_it/article/details/41693633 有关http与https的区别请看<浅谈http与https的区别( ...
- apache Tomcat配置SSL(https)步骤
Tomcat配置https 1 生成Server端安全证书 要实现通信加密,首先要在本地准备一份符合X.509标准的Server端安全证书.如果有条件的话,可以向权威CA申请一份经过认证的安 ...
- nginx,apache,tomcat配置https的阿里提供的文档
安装证书 ( 1 ) 打开 Nginx 安装目录下 conf 目录中的 nginx.conf 文件,找到 # HTTPS server # #server { # listen 443; # serv ...
- linux apache Tomcat配置SSL(https)步骤
https简介 它是由Netscape开发并内置于其浏览器中,用于对数据进行压缩和解压操作,并返回网络上传送回的结果.HTTPS实际上应用了Netscape的安全套接字层(SSL)作为HTTP应用层的 ...
- Apache Tomcat 8.5 安全配置与高并发优化
通常我们在生产环境中,Tomcat的默认配置显然不能满足我们的产品需求,所以很多时候都需要对Tomcat的配置进行调优,以下综合我自己的经验来配置 Tomcat 安全与优化情况,如果你有更好的方案,请 ...
- Apache Tomcat下载、安装、环境变量配置以及项目部署
前言 针对在本地访问文件或资源出现的跨域问题,可以通过搭建本地服务器来解决,本篇随笔主要介绍通过搭建Apache Tomcat服务器来解决跨域.包括Apache Tomcat的下载.安装.环境变量的配 ...
- 天河微信小程序入门:阿里云tomcat免费配置https
天河君在第一时间通过了微信小程序验证,开启了我的微信小程序之旅.因为天河君之前是一名后端狗,对前端不是很了解,所以几乎可以认为是从零开始学做微信小程序.也希望有志在微信小程序方向做点事情的朋友能够和我 ...
- Apache +Tomcat的负载均衡与集群配置
实验拓扑图: 一.搭配环境 (1).Tomcat的安装和配置 Tomcat_a的ip:192.168.55.229 Tomcat_b的ip:192.168.55.231 Tomcat的需要安装jdk和 ...
随机推荐
- ArcEngine:空间索引格网大小无效
参考如下帖子:http://www.cnblogs.com/linhugh/archive/2012/07/24/2606439.html\ C# 代码如下 IFeatureClass pNewFtC ...
- c# 考试
重点:值类型的变量直接存放实际的数据,存储在内存的栈中: 引用类型的变量存放的则是数据的地址,即对象的引用.存储在内存的堆中,而内存单元中只存放堆中对象的地址 常见的值类型数据有:整值型(整形,浮点型 ...
- 有效的PhoneGap CSS: WebKit Tap Highlight Color
原文链接:文章1:http://phonegap-tips.com/articles/essential-phonegap-css-webkit-tap-highlight-color.html(此文 ...
- Android课程---进度条及菜单的学习
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- IOS第18天(2,CALayer自定义图层)
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typica ...
- java调用 webservices接口实现天气预报
最近要用到web services,而这两天也比较有空,就弄了一个获取天气预报的Util.以前以为这有多难,因为数据来源是个困难.现在用web services的技术,发现下面这个是相当不错的.下面就 ...
- autocomplete一次返回多个值,并且选定后填到不同的Textbox中
$(txtTest1).autocomplete({ source: function (request, response) { $.ajax({ url: 'HttpHandler.ashx?to ...
- python file模块 替换输入内容脚本
root@python-10:/home/liujianzuo/python/test# ls passwd rc.local test1 root@python-10:/home/liujianzu ...
- Vcenter server 5.5添加用户角色及分配权限
角色:各种角色定义了对此角色可操作细节的权限组合. 用户权限:用户权限是对ESXi 5.0中的对象实例(如ESXi 5.0主机,虚拟机,存储,网络等)进行权限的分配.通过在这些对象上绑定“用户+角色” ...
- 在CentOS 6.6下安装与配置mysql
1.使用yum安装mysql yum list | grep mysql //查看mysql信息 yum install mysql-server.x86_64 //安装mysql sudo ap ...