Static or dynamic content

Jens Dueholm Christensen JEDC at ramboll.com
Fri Sep 30 09:56:50 UTC 2016


On Friday, September 30, 2016 12:02 AM Francis Daly wrote,

>> 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.

> My config is exactly this:
[SNIP]

> Do you see the problem when you test with that?

> (The file /tmp/offline.html does not exist.)

Alas I will have to test, but I am unable to do so today and I am out of the office for most parts of next week, so I'll have to get back to you on that.

>> When the request method is a POST nginx transforms this to a 405 "not
>> allowed", which is - as far as I can understand from a number of posts
>> found googling - is to be expected when POSTing to a static resource.

> If you can build a repeatable test case -- either like the above, or
> perhaps configure a HAProxy instance that will return the 503 itself --
> then it should be possible to see what is happening.

Yes, that would be preferable, but I'd just like to have others comment on what I'm seeing before I went there.

>> That 503 response is sent back to HAProxy, which parses it along to
>> nginx, which returns the 503 to the client (and it's NOT converted into
>> a 405!), so I know that nginx doesn't translate all 503s to 405s if it's
>> generated by a backend instance even if the request is POSTed.

> 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.
Given the nature of this system and that we recieve anywhere from 5000 to 20.000+ hits per minute it could be close to impossible - but if it comes down to that I must find a way if I cannot reproduce it locally..

>> This leads me to think that somehow HAProxy does not provide the
>> correct headers in the 503 errorpage to make nginx assume the response
>> from HAProxy isn't dynamic.

> I suspect that that is incorrect -- 503 is 503 -- but a config that
> allows the error be reproduced will be very helpful.

Oh yes - and given the fact that nginx as well as HAProxy is pretty darn good at handling http requests I know my idea is a bit far fetched, but from what I'm seeing I cannot come up with another good reason for this behaviour apart from moonbeams, unusual sunspot activity localized to this single nginx instance in my environment in my datacenter or leprechauns hunting gold - which quite frankly I've never before (and never will) accept as possible explanations for anything.. ;)

Regards,
Jens Dueholm Christensen



More information about the nginx mailing list