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用来判断是否存在文 ...
随机推荐
- Buck电路匹配和二极管仿真模式
Buck带同步整流,关闭二极管仿真模式会使空载损耗大 利用二极管仿真模式提高降压转换器轻负载效率 Buck电路工作原理以及三种工作模式分析 一.Buck电路原理图 Buck电路,又称降压电路,其基 ...
- caffe---ubuntu1604下anaconda2.5的尝试----失败,建议使用系统的python系统,避免各种各样的陷阱
caffe---ubuntu1604下anaconda2.5的尝试----失败,建议使用系统的python系统,避免各种各样的陷阱. 如果使用caffe+ anacoanda 已经遇到的陷阱有 1. ...
- Django之sitemap
##########settings.py SITE_ID=1 # Application definition # taggit tag INSTALLED_APPS = [ 'myblog', ' ...
- Oracle更新时间字段
update field set BEGINDATE=to_date('2015-05-03 10:30:20','yyyy-mm-dd hh24:mi:ss') where NOO='01'
- JavaScript读书笔记(6)-Function
Function类型 ECMAScript中函数是对象,每个函数都是Function类型的实例,也有属性和方法,函数是对象,函数名实际上市一个指向函数对象的指针,不会与某个函数绑定: function ...
- mongodb distinct去重
MongoDB的destinct命令是获取特定字段中不同值列表.该命令适用于普通字段,数组字段和数组内嵌文档. mongodb的distinct的语句: db.users.distinct('last ...
- NERO8.0刻录系统光盘
正常启动NREO,点击NERO 8.0左下角图标(启动NERO应用程序和工具),选NERO Express Essentials,在左边的几个选项中选择“映像.项目.复制”,右边选“光盘映像或保存的项 ...
- 关于打开sdk下载不了的最优秀解决方式
使用网站: mirrors.neusoft.edu.cn 东北大学就可以
- 使用appium和testng实现Android自动截图
简单介绍 需求场景是:当测试安卓应用的脚本得到失败结果时,对当前手机屏幕截图,便于查找问题. 实现方式是:1)定义一个父类UITest,作为所有测试类的父类.在父类中UITest中定义一个截图的方法, ...
- MySQL——多版本并发控制
核心心知识点: (1)MVCC的优点和缺点 (2)MVCC的工作机制 之前在提及幻读的时候,提到过InnoDB的多版本并发控制可以解决幻读问题. 大多数MySQL的事务性存储引擎,例如InnoDB.F ...