How to redirect back to domain name when proxying

Mike Crawford mike.crawford at gmail.com
Mon Apr 28 19:06:12 MSD 2008


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 Sat, Apr 26, 2008 at 1:47 AM, Igor Sysoev <is at rambler-co.ru> wrote:
>
> On Fri, Apr 25, 2008 at 05:03:00PM -0400, Mike Crawford wrote:
>
>  > 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;
>  > }
>
>  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;
>
>
>  --
>  Igor Sysoev
>  http://sysoev.ru/en/
>
>





More information about the nginx mailing list