Peter Salomonsen
Peter Salomonsen

Reputation: 5683

kubernetes nginx ingress Request Header Or Cookie Too Large

My nginx-ingress-controller is in the ingress-nginx namespace and I've set the large-client-header-buffers to 4 16k, 4 32k etc.

kind: ConfigMap
apiVersion: v1
metadata:
  name: nginx-configuration
  namespace: ingress-nginx  
data:
  proxy-buffer-size: "16k"
  large-client-header-buffers: "4 16k"

When I inspect the configuration in the nginx-controller pod I see:

 kubectl exec -n ingress-nginx nginx-ingress-controller-65fd579494-jptxh cat /etc/nginx/nginx.conf | grep large_client_header
        large_client_header_buffers     4 16k;

So everything seems to be configured correctly, still I get the error message 400 Bad Request Request Header Or Cookie Too Large

Upvotes: 5

Views: 23714

Answers (2)

Mikołaj Głodziak
Mikołaj Głodziak

Reputation: 5277

There is dedicated topic on github about the problem. You can find there possible solutions. This problem should be completely removed based on this issue.

Look also at more tutorials how can you solve this problem, but from the browser site:

Upvotes: 4

yan
yan

Reputation: 1541

Make sure every nginx/ingress the request passed through should contain the config

  • ingress : add 'large_client_header_buffers' in config
  • nginx: add 'http2_max_header_size' 'http2_max_field_size' in nginx config

https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#large-client-header-buffers

http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_header_size https://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_field_size

Upvotes: 1

Related Questions