Handle 400 Request Header Or Cookie Too Large (494) #3112
Closed
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.
Summary
Handle HTTP 494 with
/kong_error_handler
.This recently came up in a security audit, we were leaking nginx error pages when sending an oversized header. (which also led us to include
server_tokens off;
, perhaps Kong should include this by default, too)Can easily be triggered by eg. configuring
key-auth
and sending a large header value.Upon inspection of the nginx source (https://github.com/nginx/nginx/blob/master/src/http/ngx_http_special_response.c#L244), I noticed that an
400 Request Header Or Cookie Too Large
was merely an internal alias of HTTP494
, which is nginx-specific.The block at https://github.com/nginx/nginx/blob/master/src/http/ngx_http_special_response.c#L394 revealed more of these corner cases:
Would you be interested in handling all of these with
/kong_error_handler
, perhaps? I'd have to investigate how to trigger them (except 499..).Full changelog
494
to errors handled by/kong_error_handler