kubernetes nginx入口请求标头或Cookie太大

时间:2019-12-10 20:22:33

标签: kubernetes nginx-ingress

我的nginx-ingress-controller位于ingress-nginx命名空间中,并且我已经将large-client-header-buffers设置为4 16k4 32k等。

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

当我检查nginx-controller窗格中的配置时,我看到:

 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;

所以一切似乎都已正确配置,但仍然收到错误消息400 Bad Request Request Header Or Cookie Too Large

1 个答案:

答案 0 :(得分:0)

确保通过请求的每个nginx / ingress都应包含配置

  • ingress:在配置中添加“ large_client_header_buffers”
  • nginx:在nginx配置中添加“ http2_max_header_size”“ http2_max_field_size”

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