Proxy pass confusion

Francis Daly francis at daoine.org
Fri Aug 24 22:00:04 UTC 2012


On Fri, Aug 24, 2012 at 01:40:27PM -0700, Jon Drukman wrote:

Hi there,

> Amazon load balancer (loadbalancer.aws.com) -> nginx servers in
> reverse-proxy/caching mode -> back end PHP servers
> 
> If I visit the nginx server directly in my browser, everything works
> perfectly.
> 
> If I visit loadbalancer.aws.com, the nginx server redirects me to
> http://decupstream, which is what I named the upstream block in my
> configuration.

Are you sure that it is nginx redirecting you, and not the back-end
servers? Look at the headers from a "curl -i" of a request that fails,
and see is there any indication that it came from the back-end. Maybe
compare that with the headers from the same request that succeeds when
you visit the nginx server directly.

The only way I can think this would happen would be if you didn't have
the "proxy_set_header Host" line in the actually-running configuration.

The nginx.conf fragment you've included fails to load. ("proxy_cache"
zone "gop" is unknown.) Can you confirm that "proxy_set_header Host"
is included in the working one, and provide a minimal fragment that
demonstrates the problem?

For example, if you omit all of the proxy_cache-related directives, do
you still see the problem? If so, then you've found a simpler test
case. (And if not, then maybe the cache configuration should be examined
more closely.)

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list