Your proxy_redirect rule does not match what is returned from your backend. Remove the "https" prefix maybe? Since you want to redirect to the current hostname, you could also use the $host variable. Then, since your server block is configured to only listen on SSL port, you could also take advantage of the $scheme variable.
proxy_redirect //application.example.com/ $scheme://$host/; --- *B. R.* On Sat, Dec 12, 2015 at 8:45 PM, pjudt <[email protected]> wrote: > 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 > > _______________________________________________ > nginx mailing list > [email protected] > http://mailman.nginx.org/mailman/listinfo/nginx >
_______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
