<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Your proxy_redirect rule does not match what is returned from your backend.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Remove the "https" prefix maybe?<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Since you want to redirect to the current hostname, you could also use the $host variable.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Then, since your server block is configured to only listen on SSL port, you could also take advantage of the $scheme variable.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">proxy_redirect //<a href="http://application.example.com/">application.example.com/</a> $scheme://$host/;<br></div><div class="gmail_extra"><div><div class="gmail_signature"><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div></div>
<br><div class="gmail_quote">On Sat, Dec 12, 2015 at 8:45 PM, pjudt <span dir="ltr"><<a href="mailto:nginx-forum@nginx.us" target="_blank">nginx-forum@nginx.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Newby working for a couple weeks.  Any guidance really appreciated.<br>
<br>
Nginx is not preserving the url from redirected backend tomcat server.<br>
<br>
Nginx url: //<a href="http://develop-application.example.com/" rel="noreferrer" target="_blank">develop-application.example.com/</a><br>
<br>
Backend tomcat url: //<a href="http://application.example.com/" rel="noreferrer" target="_blank">application.example.com/</a><br>
<br>
tomcat redirects url: //<a href="http://application.example.com/application" rel="noreferrer" target="_blank">application.example.com/application</a><br>
<br>
I want the client browser url to always remain<br>
<a href="https://develop-application.example.com/application" rel="noreferrer" target="_blank">https://develop-application.example.com/application</a> no matter what returns<br>
from tomcat.<br>
<br>
Config:<br>
<br>
server {<br>
        listen 443 proxy_protocol;<br>
        set_real_ip_from <a href="http://0.0.0.0/0" rel="noreferrer" target="_blank">0.0.0.0/0</a>;<br>
        real_ip_header proxy_protocol;<br>
        access_log<br>
/var/log/nginx/develop-application.example.com.https.access.log elb_log;<br>
<br>
        server_name <a href="http://develop-application.example.com" rel="noreferrer" target="_blank">develop-application.example.com</a>;<br>
<br>
        ssl on;<br>
        ssl_certificate /etc/nginx/ssl/example.com.crt.chained;<br>
        ssl_certificate_key /etc/nginx/ssl/example.com.key;<br>
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;<br>
        ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';<br>
        ssl_prefer_server_ciphers on;<br>
        ssl_session_cache shared:SSL:10m;<br>
<br>
        location / {<br>
<br>
            proxy_pass <a href="https://application.example.com/" rel="noreferrer" target="_blank">https://application.example.com/</a>;<br>
            proxy_redirect <a href="https://application.example.com/" rel="noreferrer" target="_blank">https://application.example.com/</a><br>
<a href="https://develop-application.example.com/" rel="noreferrer" target="_blank">https://develop-application.example.com/</a>;<br>
            proxy_set_header  Host $http_host;<br>
<br>
            }<br>
}<br>
<br>
Posted at Nginx Forum: <a href="https://forum.nginx.org/read.php?2,263441,263441#msg-263441" rel="noreferrer" target="_blank">https://forum.nginx.org/read.php?2,263441,263441#msg-263441</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br></div></div>