Welcome! Log In Create A New Profile

Advanced

Re: Static or dynamic content

Francis Daly
September 30, 2016 06:56AM
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@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Static or dynamic content

Jens Dueholm Christensen September 28, 2016 07:04AM

Re: Static or dynamic content

Francis Daly September 29, 2016 06:04PM

RE: Static or dynamic content

Jens Dueholm Christensen September 30, 2016 05:58AM

Re: Static or dynamic content

Francis Daly September 30, 2016 06:56AM

RE: Static or dynamic content

Jens Dueholm Christensen October 15, 2016 08:20AM

Re: Static or dynamic content

Francis Daly October 18, 2016 02:30AM

RE: Static or dynamic content

Jens Dueholm Christensen October 20, 2016 05:22AM

Re: Static or dynamic content

Francis Daly October 20, 2016 12:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 309
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready