Static or dynamic content

Francis Daly francis at daoine.org
Fri Sep 30 10:54:50 UTC 2016


On Fri, Sep 30, 2016 at 09:56:50AM +0000, Jens Dueholm Christensen wrote:
> On Friday, September 30, 2016 12:02 AM Francis Daly wrote,

Hi there,

> >> I've got an issue where nginx (see below for version/compile options)
> >> returns a 405 (not allowed) to POST requests to clients when the upstream
> >> proxy returns a 503.
> 
> > I don't see that, when I try to build a test system.
> 
> > Are you doing anything clever with error_page or anything like that?
> 
> No, I have an "error_page 503" and a similar one for 404 that points to two named locations, but that's it.

That might matter.

I can now get a 503, 404, or 405 result from nginx, when upstream sends a 503.

Add

    error_page 503 @err;
    proxy_intercept_errors on;

within the server{} block, and add

    location @err {
      root /tmp;
    }

Now make /tmp/x exist, and /tmp/y not exist.

A GET request for /x is proxied, gets a 503, and returns the content of
/tmp/x with a 503 status.

A GET request for /y is proxied, gets a 503, and returns a 404 status.

A POST request for /x is proxied, gets a 503, and returns a 405 status.

A POST request for /y is proxied, gets a 503, and returns a 404 status.

Since you also have an error_page for 404, perhaps that does something
that leads to the output that you see.

I suspect that when you show your error_page config and the relevant
locations, it may become clearer what you want to end up with.


> > If you can see the bytes on the wire between HAProxy and nginx in both
> > cases, the difference may be obvious.
> 
> Yes, but alas that involves tinkering with a production system and/or having tcpdump running just at the right point in time when all backends are down.

A test system which talks to a local HAProxy which has no "up" backends
would probably be quicker to build.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list