nginx reverser proxy tomcat with tomcat not working

AjaySawant nginx-forum at
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( 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 and because of that my application doesn't open
as tomcat is running on 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_pass http://localhost:8080/auth_app/;

Posted at Nginx Forum:,274372,274372#msg-274372

More information about the nginx mailing list