-
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
fix_error_handler_494 #12114
fix_error_handler_494 #12114
Conversation
a7afbd4
to
b47005c
Compare
b47005c
to
7db60b5
Compare
682327c
to
a89dc7b
Compare
@@ -81,7 +81,8 @@ server { | |||
listen $(entry.listener); | |||
> end | |||
|
|||
error_page 400 404 405 408 411 412 413 414 417 494 /kong_error_handler; | |||
error_page 400 404 405 408 411 412 413 414 417 /kong_error_handler; | |||
error_page 494 =494 /kong_error_handler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems we return 400
. So can remove =494
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=494
is essential, or the status code got in error_handler is always 400.
@@ -59,6 +59,10 @@ return function(ctx) | |||
local status = kong.response.get_status() | |||
local message = get_body(status) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if we add some comments in the code to explain why we do this.
status code 494. There is a dedicated response body for 494 defined in error_handler. However, based on the current configuration for `error_page` in nginx-kong.conf, 494 will not be treated correctly wihout reserving it by the `=response` option in `error_page` directive. In this PR, a `error_page` configuration is added for 494 separately, so that it can be recognized in error handler, and it will be replaced with 400 finally. FTI-5374
a89dc7b
to
7ee8fcd
Compare
Cherry-pick failed for Please cherry-pick the changes locally. git remote add upstream https://github.com/kong/kong-ee
git fetch upstream master
git worktree add -d .worktree/cherry-pick-12114-to-master-to-upstream upstream/master
cd .worktree/cherry-pick-12114-to-master-to-upstream
git checkout -b cherry-pick-12114-to-master-to-upstream
ancref=$(git merge-base 25149497a5f8f71ef8693e46b8e183c0d08e46eb 7ee8fcd4c0afad181ae83278be7991fd5384ac99)
git cherry-pick -x $ancref..7ee8fcd4c0afad181ae83278be7991fd5384ac99 |
Summary
fix the bug that error handler can't recognize status code 494.
There is a dedicated response body for 494 defined in error_handler. However, based on the current configuration for
error_page
in nginx-kong.conf, 494 will not be treated correctly wihout reserving it by the=response
option inerror_page
directive. In this PR, aerror_page
configuration is added for 494 separately, so that it can be recognized in error handler, and it will be replaced with 400 finally.Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdFull changelog
Issue reference
FTI-5374