配置nginx里url rewrite的时候,为了使浏览器地址栏的URL保持不变,

使用proxy_pass反向代理,但发现每次都会生成新的jsessionid

解决方法,配置中增加

proxy_cookie_path /two/ /;

官网说明如下:
Syntax: proxy_cookie_path off;
proxy_cookie_path path replacement;
Default:
proxy_cookie_path off;
Context: httpserverlocation

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 导致验证码不正确的更多相关文章

  1. thinkphp nginx php-fpm url rewrite 导致 404 错误

    ## thinkphp nginx php-fpm url rewrite 导致 404 错误 之前thinkphp的系统部署在apache上,考虑到在并发性能nginx比apache强悍得多,所以在 ...

  2. Nginx Rewrite详解

    Nginx Rewrite详解 引用链接:http://blog.cafeneko.info/2010/10/nginx_rewrite_note/ 原文如下: 在新主机的迁移过程中,最大的困难就是W ...

  3. Nginx Rewrite研究笔记

    原文出自:http://blog.cafeneko.info/2010/10/nginx_rewrite_note/ 在新主机的迁移过程中,最大的困难就是WP permalink rewrite的设置 ...

  4. nginx——rewrite模块

    1.什么是Nginx的Rewrite规则? Rewrite主要的功能就是实现URL的重写,Nginx的Rewrite规则采用PCRE(Perl Compatible Regular Expressio ...

  5. Nginx Rewrite规则记录

    Rewrite 是一种服务器的重写脉冲技术,它可以使得服务器可以支持 URL 重写,是一种最新流行的服务器技术.它还可以实现限制特定IP访问网站的功能.很多情况下,某个 IP 的访问很容易造成 CPU ...

  6. Nginx rewrite(重读)

    Nginx Rewrite规则相关指令  Nginx Rewrite规则相关指令有if.rewrite.set.return.break等,其中rewrite是最关键的指令.一个简单的Nginx Re ...

  7. [转帖]Nginx rewrite模块深入浅出详解

    Nginx rewrite模块深入浅出详解 https://www.cnblogs.com/beyang/p/7832460.html rewrite模块(ngx_http_rewrite_modul ...

  8. Nginx rewrite(重写)

    Nginx Rewrite规则相关指令  Nginx Rewrite规则相关指令有if.rewrite.set.return.break等,其中rewrite是最关键的指令.一个简单的Nginx Re ...

  9. nginx rewrite规则实例讲解

    一.正则表达式匹配,其中: * ~ 为区分大小写匹配* ~* 为不区分大小写匹配* !~和!~*分别为区分大小写不匹配及不区分大小写不匹配 二.文件及目录匹配,其中:* -f和!-f用来判断是否存在文 ...

随机推荐

  1. (二)关于jQuery

    jQuery是一个快速.简洁的JavaScript框架,是继Prototype之后又一个优秀的JavaScript代码库(或JavaScript框架).jQuery设计的宗旨是“write Less, ...

  2. HDU 2255 奔小康赚大钱 KM裸题

    #include <stdio.h> #include <string.h> #define M 310 #define inf 0x3f3f3f3f int n,nx,ny; ...

  3. SpringMVC hibernate增加多数据源 (SSHE/SYPRO增加多数据源为例)

    SpringMVC hibernate增加多数据源 (以类SSHE/SYPRO增加多数据源为例作说明) 注:适用与SpringMVC + Hibernate的项目.其它框架的仅仅能说作參考用 配置Sp ...

  4. 小白学习python之路(二):安装开发工具

    引言 上一章我们安装配置了python3.7,这一章我们安装python的开发工具,我用的pycharm2019 安装 工具连接:https://u20538204.ctfile.com/fs/205 ...

  5. 非标准USBasp下载线烧录Arduino BootLoader的参数设置

    本文仅适用于BootLoader损坏且买到国产“免驱USBasp下载线”导致Arduino IDE无法识别从而不能烧写的情况.是一种略显非主流的操作方式. 因为Arduino的IDE并不支持这种免驱的 ...

  6. WARN util.NativeCodeLoader: Unable to load native-hadoop l... using builtin-java classes where applicable(附编译脚本)

    WARN util.NativeCodeLoader: Unable to load native-hadoop l... using builtin-java classes where appli ...

  7. 分布式服务框架 Zookeeper(一)介绍

    一.概述 ZooKeeper(动物园管理员),顾名思义,是用来管理Hadoop(大象).Hive(蜜蜂).Pig(小猪)的管理员,同时Apache Hbase.Apache Solr.LinkedIn ...

  8. 【打CF,学算法——一星级】Codeforces Round #313 (Div. 2) A. Currency System in Geraldion

    [CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/A 题面: A. Currency System in Geraldion time l ...

  9. “volatile”这个关键字

    我们经常使用“volatile”这个关键字,它是什么意思? 解析:volatile问题.当一个对象的值可能会在编译器的控制或监测之外被改变时,例如一个被系统时钟更新的变量,那么该对象应该声明成vola ...

  10. CPU接口练习 (仅以此程序证明 某个同学真的有毒!有毒!!!)

    1创建接口 package lianxi; public interface ICpu { public boolean neiCun();//内存接口 } 2创建一个类 连接这个接口 package ...