Header too long

Hi @hbagdi

In our project, we have Kong version 1.1 with Kong Ingress controller 0.3 version.

At an instance in the application, the request header size is going above 8k. Hence we are getting “Header too long”.

We tried setting up #client_max_body_size = 16k, by setting KONG_CLIENT_MAX_BODY_SIZE in as the environment variable but it is not getting reflected. While starting the kong in debug mode it is showing client_max_body_size=16k, but while serving a request it is throwing
Header too long error.

Thanks in advance

I met same problem

I found this : Request Header Or Cookie Too Large

I finally set follow at env: in values file of stable chart
If you do not use stable chart, you can add env in kong deployment


This probably is because of large headers (cookies usually).

You want to set https://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers using Kong’s Nginx directive injection mechanism.

@hbagdi thanks for replying.

As explained by you, I tried setting up #large_client_header_buffers by setting up env environment with the help of Nginx directive injection mechanism. I have assigned following,


The changes have been reflected in .kong_env, but still the issue is not resolved.

Here are the changes reflected in .kong_env

# *************************
# *************************
# This configuration file is auto-generated. If you want to modify
# the Kong configuration please edit/create the original `kong.conf`
# file. Any modifications made here will be lost.
# Start Kong with `--vv` to show where it is looking for that file.

plugins = bundled
admin_listen = off
nginx_proxy_large_client_header_buffers = 8 24k

The Request header size is : Request Headers (8.401 KB)

Response error: Status Code: 431 Request Header Fields Too Large

Kindly validate if I have set it right. Thanks in advance.

I’m not an Nginx Ninja so I’m not sure what is going wrong here.
Maybe also try: https://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_buffer_size.

@datong.sun might have a clue.

1 Like

@Raunak_Khatri Is the upstream app in Node JS?

Yes @arun7 the upstream server is NodeJs.

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ