Nginx Jsessionid 改变重定向问题
Ngnix Jsession changed redirection issue
有一个设置,例如 运行 www.xyz.com 上的一个应用程序,并且有一份报告对 www.abc.com 上托管的应用程序进行了休息。
由于 IE8 上的 CORS 奇怪问题,我们将其余请求放在 www.xyz.com 上,但实际上服务托管在 www.abc.com 上,因此在 ngnix 级别,我们正在重定向来自 www.xyz.com 到 www.abc.com.
但是在 www.xzy.com 应用程序上使用报告后,当我们转到另一个页面时,会话会过期。 www.xyz.com.
上使用报告后jsessionid发生了变化
提前致谢。
server {
listen 80;
server_name www.xyz.com;
charset utf-8;
rewrite ^(.*) https://$server_name permanent;
}
server {
listen 443;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/nginx/ssl.crt/server.crt;
ssl_certificate_key /etc/nginx/ssl.key/server.key;
server_name www.xyz.com;
error_log /var/log/nginx/error.log;
charset utf-8;
location / {
proxy_pass http://localhost:97;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
client_max_body_size 10M;
}
location /api/rest/b2b/v1/report/filters/program-summary {
proxy_pass http://localhost:90/api/rest/b2b/v1/report/filters/program-summary;
proxy_redirect off;
proxy_pass_request_headers on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
client_max_body_size 10M;
proxy_set_header X-Forwarded-Proto https;
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token';
}
location /api/rest/b2b/v1/report/headers/grid/program-summary/DATAGRID {
proxy_pass http://localhost:90/api/rest/b2b/v1/report/headers/grid/program-summary/DATAGRID;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
client_max_body_size 10M;
proxy_set_header X-Forwarded-Proto https;
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token';
}
location /api/rest/b2b/v1/report/headers/grid/program-summary/SALES_REP {
proxy_pass http://localhost:90/api/rest/b2b/v1/report/headers/grid/program-summary/SALES_REP;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
client_max_body_size 10M;
proxy_set_header X-Forwarded-Proto https;
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token';
}
location /api/rest/b2b/v1/report/filters/variable/program-summary {
proxy_pass http://localhost:90/api/rest/b2b/v1/report/filters/variable/program-summary;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token';
}
location /api/rest/b2b/v1/query/program-summary/barchart {
proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/barchart;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
client_max_body_size 10M;
proxy_set_header X-Forwarded-Proto https;
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token';
}
location /api/rest/b2b/v1/query/program-summary/datagrid {
proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/datagrid;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
client_max_body_size 10M;
proxy_set_header X-Forwarded-Proto https;
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token';
}
location /api/rest/b2b/v1/query/program-summary/status_pie {
proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/status_pie;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
client_max_body_size 10M;
proxy_set_header X-Forwarded-Proto https;
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token';
}
location /api/rest/b2b/v1/query/program-summary/summary {
proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/summary;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
client_max_body_size 10M; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token';
}
location /api/rest/b2b/v1/query/program-summary/sales_datagrid {
proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/sales_datagrid;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
client_max_body_size 10M;
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token';
}
location /api/rest/b2b/v2/constants/CDN_URL {
proxy_pass http://localhost:90/api/rest/b2b/v2/constants/CDN_URL;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_set_header Host $http_host;
client_max_body_size 10M;
}
location ~ ^/templates/(.*)$ {
alias /webroot/reporting-dashboard/templates/;
}
location ~ ^/data/(.*)$ {
alias /webroot/reporting-dashboard/data/;
}
location ~ ^/styles/(.*)$ {
alias /webroot/reporting-dashboard/styles/;
}
location ~ ^/bower_components/(.*)$ {
alias /webroot/reporting-dashboard/bower_components/;
}
location /scripts/62219e5b.vendor.js {
alias /webroot/reporting-dashboard/scripts/62219e5b.vendor.js;
}
location /scripts/9ec589bc.plugins.js {
alias /webroot/reporting-dashboard/scripts/9ec589bc.plugins.js;
}
location /scripts/e13d4652.main.js {
alias /webroot/reporting-dashboard/scripts/e13d4652.main.js;
}
error_page 502 503 504 /vzb_50x.html;
location = /vzb_50x.html {
root /tomcats/webapps/ROOT/static/errorFiles;
}
}
在conf文件中添加proxy_hide_header Set-Cookie;
已经解决了问题。这基本上从响应中删除了 cookie。
有一个设置,例如 运行 www.xyz.com 上的一个应用程序,并且有一份报告对 www.abc.com 上托管的应用程序进行了休息。
由于 IE8 上的 CORS 奇怪问题,我们将其余请求放在 www.xyz.com 上,但实际上服务托管在 www.abc.com 上,因此在 ngnix 级别,我们正在重定向来自 www.xyz.com 到 www.abc.com.
但是在 www.xzy.com 应用程序上使用报告后,当我们转到另一个页面时,会话会过期。 www.xyz.com.
上使用报告后jsessionid发生了变化提前致谢。
server { listen 80; server_name www.xyz.com; charset utf-8; rewrite ^(.*) https://$server_name permanent; } server { listen 443; ssl on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_certificate /etc/nginx/ssl.crt/server.crt; ssl_certificate_key /etc/nginx/ssl.key/server.key; server_name www.xyz.com; error_log /var/log/nginx/error.log; charset utf-8; location / { proxy_pass http://localhost:97; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; client_max_body_size 10M; } location /api/rest/b2b/v1/report/filters/program-summary { proxy_pass http://localhost:90/api/rest/b2b/v1/report/filters/program-summary; proxy_redirect off; proxy_pass_request_headers on; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; client_max_body_size 10M; proxy_set_header X-Forwarded-Proto https; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token'; } location /api/rest/b2b/v1/report/headers/grid/program-summary/DATAGRID { proxy_pass http://localhost:90/api/rest/b2b/v1/report/headers/grid/program-summary/DATAGRID; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_set_header Host $http_host; client_max_body_size 10M; proxy_set_header X-Forwarded-Proto https; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token'; } location /api/rest/b2b/v1/report/headers/grid/program-summary/SALES_REP { proxy_pass http://localhost:90/api/rest/b2b/v1/report/headers/grid/program-summary/SALES_REP; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_set_header Host $http_host; client_max_body_size 10M; proxy_set_header X-Forwarded-Proto https; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token'; } location /api/rest/b2b/v1/report/filters/variable/program-summary { proxy_pass http://localhost:90/api/rest/b2b/v1/report/filters/variable/program-summary; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto https; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token'; } location /api/rest/b2b/v1/query/program-summary/barchart { proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/barchart; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_set_header Host $http_host; client_max_body_size 10M; proxy_set_header X-Forwarded-Proto https; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token'; } location /api/rest/b2b/v1/query/program-summary/datagrid { proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/datagrid; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_set_header Host $http_host; client_max_body_size 10M; proxy_set_header X-Forwarded-Proto https; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token'; } location /api/rest/b2b/v1/query/program-summary/status_pie { proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/status_pie; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_set_header Host $http_host; client_max_body_size 10M; proxy_set_header X-Forwarded-Proto https; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token'; } location /api/rest/b2b/v1/query/program-summary/summary { proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/summary; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_set_header Host $http_host; client_max_body_size 10M; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token'; } location /api/rest/b2b/v1/query/program-summary/sales_datagrid { proxy_pass http://localhost:90/api/rest/b2b/v1/query/program-summary/sales_datagrid; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_set_header Host $http_host; client_max_body_size 10M; 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,origin,authorization,accept,client-security-token'; } location /api/rest/b2b/v2/constants/CDN_URL { proxy_pass http://localhost:90/api/rest/b2b/v2/constants/CDN_URL; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass_request_headers on; proxy_set_header Host $http_host; client_max_body_size 10M; } location ~ ^/templates/(.*)$ { alias /webroot/reporting-dashboard/templates/; } location ~ ^/data/(.*)$ { alias /webroot/reporting-dashboard/data/; } location ~ ^/styles/(.*)$ { alias /webroot/reporting-dashboard/styles/; } location ~ ^/bower_components/(.*)$ { alias /webroot/reporting-dashboard/bower_components/; } location /scripts/62219e5b.vendor.js { alias /webroot/reporting-dashboard/scripts/62219e5b.vendor.js; } location /scripts/9ec589bc.plugins.js { alias /webroot/reporting-dashboard/scripts/9ec589bc.plugins.js; } location /scripts/e13d4652.main.js { alias /webroot/reporting-dashboard/scripts/e13d4652.main.js; } error_page 502 503 504 /vzb_50x.html; location = /vzb_50x.html { root /tomcats/webapps/ROOT/static/errorFiles; } }
在conf文件中添加proxy_hide_header Set-Cookie;
已经解决了问题。这基本上从响应中删除了 cookie。