How to redirect back to domain name when proxying

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

Thanks Igor!

For the record, if CAS is not redirecting back to where you want it by
default - another way to resolve this is to set the CAS service
parameter.

Regards,

Mike

On Fri, Apr 25, 2008 at 05:03:00PM -0400, Mike Crawford wrote:

I’m trying to understand the proxy documentation but I can’t figure

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

Remove “proxy_redirect on”, there is no special keyword “on”.
And use
proxy_redirect http://<ip_addr>:<tomcat_port>/app
www.mydomain.com/app;
or
proxy_redirect http://<ip_addr>:<tomcat_port>/app /app;

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs