-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logs for 502 errors are always indicating GET, even if POST was used #4751
Comments
Hi, Thank you for the report. This is a known issue, which comes from an Nginx limitation. This has already been reported in #4025, which also proposes an Nginx patch that will be shipped with an upcoming release of Kong (and OpenResty, eventually). Closing this in the meantime so we can keep the conversation focused on #4025. Best, |
thibaultcha
added a commit
that referenced
this issue
Sep 26, 2019
…errors This commit fixes the outstanding caveat of using logging plugins to log NGINX-produced errors. The caveat - described in e709c95 - causes some request properties (i.e. method and uri args) to be incorrectly logged. Since e709c95, Kong executes plugins on NGINX-produced errors. However, as described in the mentioned commit's message, a caveat with the approach (note: the sanest one) is that the request method is overridden by the `error_page` directive during the internal redirect (and the uri args do not survive the redirect either). This commit chooses to rely on the PDK to fix this limitation, and manually parses the request headers when necessary (and possible). Fix #4025 Fix #4751
hishamhm
pushed a commit
that referenced
this issue
Sep 27, 2019
…errors This commit fixes the outstanding caveat of using logging plugins to log NGINX-produced errors. The caveat - described in e709c95 - causes some request properties (i.e. method and uri args) to be incorrectly logged. Since e709c95, Kong executes plugins on NGINX-produced errors. However, as described in the mentioned commit's message, a caveat with the approach (note: the sanest one) is that the request method is overridden by the `error_page` directive during the internal redirect (and the uri args do not survive the redirect either). This commit chooses to rely on the PDK to fix this limitation, and manually parses the request headers when necessary (and possible). Fix #4025 Fix #4751
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
When an upstream server returns no data, kong correctly replies with a 502 error "An invalid response was received from the upstream server". That first part is correct.
However, in the logs (for example with
tcp-log
andudp-log
), the request always shows up as aGET
request, even if aPOST
was sent.Note that it seems to happen ONLY when no byte is sent back by the upstream. The method is correct with a response of 6 bytes (haven't tested with less, but I suspect 1 byte is enough).
Impact
Mild, mostly. We did waste a few hours looking at our code with disbelief, but production still works.
Steps To Reproduce
Clone this repository and follow the steps in the README: https://github.com/aspyct/kong502
You'll need docker and docker-compose.
Additional Details & Logs
$ kong start --vv
)<KONG_PREFIX>/logs/error.log
)https://docs.konghq.com/latest/admin-api/#retrieve-node-information)
The text was updated successfully, but these errors were encountered: