Nginx and Websphere

sampy nginx-forum at nginx.us
Fri May 29 16:51:51 UTC 2015


Francis Daly Wrote:
-------------------------------------------------------
> On Fri, May 29, 2015 at 02:01:00AM -0400, sampy wrote:
> 
> Hi there,
> 
> > Now it's near to work!
> 
> Good news.
> 
> > With this configuration:
> > 
> > upstream webint {
> >                 #ip_hash;
> >                 server wasint-1.domain.com:9080;
> >                 server wasint-2.domain.com:9080;
> >         }
> > 
> >     server {
> > 
> >         listen 80;
> >         server_name web.domain.com;
> > 
> >         location /WebApp {
> >                 #proxy_set_header Host $host;
> >                 proxy_set_header X-Real-IP $remote_addr;
> >                 proxy_set_header X-Forwarded-For
> > $proxy_add_x_forwarded_for;
> >                 proxy_pass http://webint;
> >                 proxy_redirect http://webint/ /;
> >                 proxy_redirect http://webint:9080/ /;
> >         }
> 
> You probably do not need "proxy_redirect http://webint/ /;", because
> what the upstream sends back probably always includes the :9080. But
> it
> does no extra harm to leave it there.
> 
> > executing "curl -i http://web.domain.com/WebApp/main.js"
> > 
> > Shows the web!!
> > 
> > And y a normal browser typing all the url
> > "http://web.domain.com/WebApp/main.jsf" shows the correct web!!
> awesome!
> > 
> > Now I want to modify the base of this configuration to type only
> > http://web.domain.com and redirect to the web I want.
> 
> Add an extra location block for that request:
> 
>   location = / { return 301 /WebApp/; }
> 
> And then issue the "curl" command for the url you want; when you get a
> 301 redirect, issuer a curl command for the Location: header returned.
> 
> If the Location: header looks wrong -- does not point at something in
> web.domain.com -- then you'll have identified which request leads to
> the unwanted response.
> 
> Good luck with it,
> 
> 	f
> -- 
> Francis Daly        francis at daoine.org
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

hi there.

I'm happy because with web.domain.com/WebApp works fine. 

But when I change LOCATION from:

location /WebApp {
upstream balancer {
                 server server1.domain.com:9080;
                 server server2.domain.com:9080;
                }

location /WebApp {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
                proxy_pass http://balancer/WebApp;
                proxy_redirect http://balancer:9080/ /;
         }
    }

}


to:
upstream balancer {
        server server1.domain.com:9080;
        server server2.domain.com:9080;
}


location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
                proxy_pass http://balancer/WebApp;
                proxy_redirect http://balancer:9080/ /;
                }

}

stop working. "curl" sees the 302 redirection in both cases, but the web is
not showed in the second case. I think I forget something or I have some
mistake in syntax.

Regards

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,259127,259267#msg-259267



More information about the nginx mailing list