nginx reverser proxy tomcat with tomcat not working

AjaySawant nginx-forum at forum.nginx.org
Mon May 22 12:32:13 UTC 2017


I am trying to proxy tomcat using nginx. I have this configuration below.
Now the problem I am facing is if I access the url by IP(192.168.2.6) then
it gets redirected to /auth_app is tomcat which is perfectly fine. The
tomcat url redirect to a third party SAML2 provider and once it
authenticated it redirected to  http://localhost:8080/auth_app/ instead of
http://192.168.2.6/auth_app/ and because of that my application doesn't open
as tomcat is running on 192.168.2.6 and not localhost. 

        server {
                listen       80 default_server;
                server_name  _;
                error_log       /var/log/nginx/abc_error.log;
                access_log      /var/log/nginx/abc_access.log;
                rewrite ^/?$ /auth_app;
                location /auth_app {
                        proxy_redirect off;
                        proxy_set_header X-Forwarded-Host $host;
                        proxy_set_header X-Forwarded-Server $host;
                        proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
                        proxy_pass http://localhost:8080/auth_app/;
                }
         }

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



More information about the nginx mailing list