nginx rewrite 导致验证码不正确
配置nginx里url rewrite的时候,为了使浏览器地址栏的URL保持不变,
使用proxy_pass反向代理,但发现每次都会生成新的jsessionid
解决方法,配置中增加
proxy_cookie_path /two/ /; 官网说明如下:
| Syntax: | proxy_cookie_path proxy_cookie_path |
|---|---|
| Default: |
proxy_cookie_path off; |
| Context: | http, server, location |
This directive appeared in version 1.1.15.
Sets a text that should be changed in the path attribute of the “Set-Cookie” header fields of a proxied server response. Suppose a proxied server returned the “Set-Cookie” header field with the attribute “path=/two/some/uri/”. The directive
proxy_cookie_path /two/ /;
will rewrite this attribute to “path=/some/uri/”.
The path and replacement strings can contain variables:
proxy_cookie_path $uri /some$uri;
The directive can also be specified using regular expressions. In this case, path should either start from the “~” symbol for a case-sensitive matching, or from the “~*” symbols for case-insensitive matching. The regular expression can contain named and positional captures, and replacement can reference them:
proxy_cookie_path ~*^/user/([^/]+) /u/$1;
There could be several proxy_cookie_path directives:
proxy_cookie_path /one/ /;
proxy_cookie_path / /two/;
The off parameter cancels the effect of all proxy_cookie_path directives on the current level:
proxy_cookie_path off;
proxy_cookie_path /two/ /;
proxy_cookie_path ~*^/user/([^/]+) /u/$1;
nginx rewrite 导致验证码不正确的更多相关文章
- thinkphp nginx php-fpm url rewrite 导致 404 错误
## thinkphp nginx php-fpm url rewrite 导致 404 错误 之前thinkphp的系统部署在apache上,考虑到在并发性能nginx比apache强悍得多,所以在 ...
- Nginx Rewrite详解
Nginx Rewrite详解 引用链接:http://blog.cafeneko.info/2010/10/nginx_rewrite_note/ 原文如下: 在新主机的迁移过程中,最大的困难就是W ...
- Nginx Rewrite研究笔记
原文出自:http://blog.cafeneko.info/2010/10/nginx_rewrite_note/ 在新主机的迁移过程中,最大的困难就是WP permalink rewrite的设置 ...
- nginx——rewrite模块
1.什么是Nginx的Rewrite规则? Rewrite主要的功能就是实现URL的重写,Nginx的Rewrite规则采用PCRE(Perl Compatible Regular Expressio ...
- Nginx Rewrite规则记录
Rewrite 是一种服务器的重写脉冲技术,它可以使得服务器可以支持 URL 重写,是一种最新流行的服务器技术.它还可以实现限制特定IP访问网站的功能.很多情况下,某个 IP 的访问很容易造成 CPU ...
- Nginx rewrite(重读)
Nginx Rewrite规则相关指令 Nginx Rewrite规则相关指令有if.rewrite.set.return.break等,其中rewrite是最关键的指令.一个简单的Nginx Re ...
- [转帖]Nginx rewrite模块深入浅出详解
Nginx rewrite模块深入浅出详解 https://www.cnblogs.com/beyang/p/7832460.html rewrite模块(ngx_http_rewrite_modul ...
- Nginx rewrite(重写)
Nginx Rewrite规则相关指令 Nginx Rewrite规则相关指令有if.rewrite.set.return.break等,其中rewrite是最关键的指令.一个简单的Nginx Re ...
- nginx rewrite规则实例讲解
一.正则表达式匹配,其中: * ~ 为区分大小写匹配* ~* 为不区分大小写匹配* !~和!~*分别为区分大小写不匹配及不区分大小写不匹配 二.文件及目录匹配,其中:* -f和!-f用来判断是否存在文 ...
随机推荐
- 转Java 开发环境配置
window系统安装java 下载JDK 首先我们需要下载java开发工具包JDK,下载地址:http://www.oracle.com/technetwork/java/javase/downloa ...
- PHP RSA加解密示例(转)
1.生成密钥和公钥 开始前需要准备openssl环境 linux 需要安装openssl工具包,传送门http://www.openssl.org/source/ window 下需要安装openss ...
- 想全面理解JWT?一文足矣!
有篇关于JWT的文章,叫"JWT: The Complete Guide to JSON Web Tokens",写得全面细致.为了自己能更清晰理解并惠及更多人,我把它大致翻译了过 ...
- Linux kernel manpages
https://www.linuxquestions.org/questions/linux-newbie-8/man-pages-for-kernel-functions-758389/ 在Linu ...
- 【特征匹配】SIFT原理与C源代码剖析
相关: KD树+BBF算法解析 SURF原理与源代码解析 SIFT的原理已经有非常多大牛的博客上做了解析,本文重点将以Rob Hess等人用C实现的代码做解析,结合代码SIFT原理会更easy理解.一 ...
- Selenium3 Python3 Web自动化测试从基础到项目实战之二浏览器的不同设置
在前面一个章节我们知道了如何通过webdriver去初始化我们得driver,然后我们只需要通过driver就能够去做我们得自动化,首先我们知道我们需要知道得是当我们有driver之后,我们剩下得就是 ...
- Redis单台的安装部署及集群部署
Redis是一种高级key-value数据库.它跟memcached类似,不过数据可以持久化,而且支持的数据类型很丰富.有字符串,链表,集 合和有序集合.支持在服务器端计算集合的并,交和补集(diff ...
- mongodb的IO测试工具 mongoperf
之前没发现mongoperf这个工具,测试IO的状态用的是iostat来进行观察. mongoperf < myjsonconfigfile echo "{nThreads:2,fi ...
- PowerBuilder -- 日期控件
MonthCalendar
- DataGrid绑定Dictionary问题
问题] 在最近的项目中使用DataGrid的DataGridCheckBoxColumn绑定了后台TagModel类的IsSelected字段,数据源是TagModel类型的Dictionary,运行 ...