URL 太长 Nginx 返回 414:
我这里的 Nginx 是部署在 Kubernetes 的 Nginx Ingress Controller。
跟着网上配了好多注解都没有效果,如下:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/client-body-buffer-size: 100m
nginx.ingress.kubernetes.io/large_client_header_buffers: 200m
nginx.ingress.kubernetes.io/proxy-body-size: 200m
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/server-snippet: |
client_header_buffer_size 1024k;
large_client_header_buffers 4 1024k;
http2_max_header_size 1024k;
http2_max_field_size 1024k;
nginx.ingress.kubernetes.io/ssl-redirect: "false"
最后有效果的是修改 Nginx Ingress Controller 的 ConfigMap,在其中添加配置如下:
apiVersion: v1
data:
allow-snippet-annotations: "true"
large-client-header-buffers: "512 512k"
评论区