feature: added the preserve_method_on_error_page patch. #396
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Wondering if this is something that we may want; please advise.
In cases where we want to access to a yield-able Lua context upon Nginx-produced or upstream errors, the
error_page
directive is our de-facto choice. However, when logging such errors (along with the request that triggered it) to an external logging stack, the request's HTTP method is overridden by Nginx toGET
, causing us to lose some context about the original request.My guess is that the override makes sense by default since most Nginx instances would then serve their HTML error page upon this internal redirect. I tracked down the behaviour from a release dating back to 2005:
nginx/nginx@ceb9929#diff-05d6b8ae21d192f78b349319edaeb9bfR295
However, there seems to be no particular reason why this would have to be the case when one produces their own content in the
error_page
location, e.g. viacontent_by_lua_*
. Hence, a directive with backwards-compatibility defaults seems to make sense.