How to redirect back to domain name when proxying

Mike Crawford mike.crawford at gmail.com
Sat Apr 26 01:03:00 MSD 2008


Hi,

I'm using proxy_pass to tomcat for one of my webapps.

The problem is that when the tomcat app calls a single-sign-on
application (CAS), CAS redirects back to the tomcat application at
'http://<ip_addr>:<tomcat_port>/app'   rather than
www.mydomain.com/app.

How can I configure the proxy_pass so that my tomcat application
presents itself to other applications as www.mydomain.com/app ?

I'm trying to understand the proxy documentation but I can't figure
out a solution.  I've tried:

location /app/ {
     proxy_pass http://<tomcat_server_name>:8089;
     proxy_redirect http://<tomcat_server_name>:8089/app/ www.mydomain.com/app;
     proxy_redirect on;
     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

AND

location /app/ {
    proxy_pass http://<tomcat_server_name>:8089;
    proxy_redirect http://<tomcat_server_name>:8089/app/ www.mydomain.com/app;
    proxy_redirect on;
}


Thanks for your help,

Mike





More information about the nginx mailing list