How to preserve nginx url from being redirected (302) from back end tomcat server?

pjudt nginx-forum at nginx.us
Sat Dec 12 19:45:45 UTC 2015


Newby working for a couple weeks.  Any guidance really appreciated.

Nginx is not preserving the url from redirected backend tomcat server.

Nginx url: //develop-application.example.com/

Backend tomcat url: //application.example.com/

tomcat redirects url: //application.example.com/application

I want the client browser url to always remain
https://develop-application.example.com/application no matter what returns
from tomcat.

Config:

server {
        listen 443 proxy_protocol;
        set_real_ip_from 0.0.0.0/0;
        real_ip_header proxy_protocol;
        access_log
/var/log/nginx/develop-application.example.com.https.access.log elb_log;

        server_name develop-application.example.com;

        ssl on;
        ssl_certificate /etc/nginx/ssl/example.com.crt.chained;
        ssl_certificate_key /etc/nginx/ssl/example.com.key;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;

        location / {

            proxy_pass https://application.example.com/;
            proxy_redirect https://application.example.com/
https://develop-application.example.com/;
            proxy_set_header  Host $http_host;
        
            }
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,263441,263441#msg-263441



More information about the nginx mailing list