Ngnix Jsession改变了重定向问题

时间:2015-06-30 11:09:34

标签: nginx

有一个设置就像在www.xyz.com上运行一个应用程序,并且有一个报告可以对www.abc.com上托管的应用程序进行休息。

由于IE8上出现了奇怪的CORS问题,我们正在www.xyz.com上发布其余内容,但实际上服务是在www.abc.com上托管的,所以在ngnix级别,我们正在重定向来自www.xyz的其余请求。 com到www.abc.com。

但是当我们转到另一个页面时,在www.xzy.com app上使用该报告后,会话就会过期。使用www.xyz.com上的报告后,jsessionid发生了变化。

提前致谢。


    server {
            listen 80;
            server_name www.xyz.com;
            charset utf-8;
            rewrite     ^(.*)   https://$server_name$1 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/$1;
            }

            location ~ ^/data/(.*)$ {
                    alias /webroot/reporting-dashboard/data/$1;
            }

            location ~ ^/styles/(.*)$ {
                    alias /webroot/reporting-dashboard/styles/$1;
            }

            location ~ ^/bower_components/(.*)$ {
                    alias /webroot/reporting-dashboard/bower_components/$1;
            }

            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;
            }
    }

1 个答案:

答案 0 :(得分:1)

在conf文件中添加proxy_hide_header Set-Cookie;解决了这个问题。这基本上从响应中删除了cookie。

https://serverfault.com/questions/641417/nginx-not-processing-proxy-hide-header-and-proxy-ignore-headers

相关问题