nginx reverser proxy tomcat with tomcat not working

Aleksandar Lazic al-nginx at none.at
Mon May 22 14:02:58 UTC 2017


Hi AjaySawant.

AjaySawant have written on Mon, 22 May 2017 08:32:13 -0400:

> 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/;
>                 }
>          }

Please can you post the server.xml, the error log from the nginx and
the output of nginx -V.

Regards
aleks


More information about the nginx mailing list