nginx rewrite 导致验证码不正确
配置nginx里url rewrite的时候,为了使浏览器地址栏的URL保持不变,
使用proxy_pass反向代理,但发现每次都会生成新的jsessionid
解决方法,配置中增加
- proxy_cookie_path /two/ /;
- 官网说明如下:
Syntax: | proxy_cookie_path proxy_cookie_path |
---|---|
Default: |
|
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 命名规则
http://lpacec.iteye.com/blog/25180包名:包名是全小写的名词,中间可以由点分隔开,例如:java.awt.event; 类名:首字母大写,通常由多个单词合成一个类名,要 ...
- solr入门之pinyin4j源代码改写动态加入扩展词及整合进war项目中
1.初始化时载入用户定义的字典 package net.sourceforge.pinyin4j; import net.sourceforge.pinyin4j.multipinyin.Trie; ...
- 双十一前4小时,CentOS 6.5server启动错误排查
11月10日晚上8点多.眼看要到双十一了... 但我要说的这段经历却和双十一毫无关系.哈哈. 这天准备向CentOS6.5server的svn上传一些文件,结果开机启动时,却出现了以下的界面: 这是肿 ...
- php的一个小坑,输出不了json_encode
明明是旧代码,怎么换个地方就不执行了.一开始怀疑是Php的版本. 最后才知道是我的编辑器nodepad++给坑了.或许不是nodepad++的坑.总之,需要转化为utf-8格式编码即可
- android 怎样加速./mk snod打包
mm命令高速编译一个模块之后,一般用adb push到手机看效果,假设环境不同意用adb push或模块不常常改.希望直接放到image里,则能够用./mk snod,这个命令只将system文件夹打 ...
- 杂谈:HTML 5的消息通知机制
译文来源:http://www.ido321.com/1130.html 原文:HTML 5 Notification 译文:HTML 5 的消息通知机制 译者:dwqs watermark/2/te ...
- 现在有一张半径为r的圆桌,其中心位于(x,y),现在他想把圆桌的中心移到(x1,y1)。每次移动一步,都必须在圆桌边缘固定一个点然后将圆桌绕这个点旋转。问最少需要移动几步。
// ConsoleApplication5.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<vector> ...
- 小程序踩坑之不同屏幕下动态改变translate值
案例还原 小程序做一个进度条,可以通过拽转控制进度 那么肯定有一个进度条,不过小程序自己会做适配宽高 6s下这个div的width 是250 6splus就是276 但是问题来了,我拖拽用的是tran ...
- LRU java实现
实现LRU缓存,用到了一个链表和 HashMap, HashMap保证了get/set的时间复杂度是O(1), 链表用来记录 最近最少使用的元素,以便用来淘汰. package lru; /** * ...
- C语言--循环结构
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvenVveW91MTMxNA==/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...