Status Code: 431Error: Request Header Fields Too Large
curl -kv https://<application-url>
Review the output for large headers such as:
Cookie
Authorization
X-Forwarded-For
curl -s -D - https://<application-url> -o /dev/null | wc -c
Large Cookie headers generated by web applications
Authentication tokens such as JWT in the Authorization header
Single Sign-On (SSO) or identity provider cookies (OIDC, OAuth, SAML)
Multiple proxies adding X-Forwarded-* headers
Applications storing session data directly in cookies
Option 1 – Increase the Allowed Header Size in the Istio Ingress Gateway
Note: In environments where Istiod (control plane) and the Istio ingress gateway are deployed in separate namespaces, the EnvoyFilter must be created in the namespace where the ingress gateway workload is deployed.
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: increase-header-size
namespace: <istio-gateway-namespace>
spec:
workloadSelector:
labels:
istio: ingressgateway
configPatches:
- applyTo: NETWORK_FILTER
match:
context: GATEWAY
listener:
filterChain:
filter:
name: envoy.filters.network.http_connection_manager
patch:
operation: MERGE
value:
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
max_request_headers_kb: 96kubectl apply -f envoyfilter.yamlkubectl rollout restart deployment <istio-ingressgateway-deployment> -n <istio-gateway-namespace>
This increases the maximum request header size accepted by the gateway.
Option 2 – Reduce the Size of Client Request Headers
Possible approaches include:
Reducing the number or size of cookies stored by the application
Avoiding storage of large session data within cookies
Minimizing large JWT tokens or authentication headers
Removing unnecessary custom headers from client requests
Ensuring intermediate proxies are not appending redundant X-Forwarded-* headers