Kubernetes Ingress returns 404 for POST requests only when client uses HTTP/2 to the edge (ingress-nginx misroutes upgraded requests)
Environment
GKE cluster (k8s v1.26) running ingress-nginx controller (v1.7) as DaemonSet, backend services use HTTP/1.1, many clients connect via ALB/proxy that supports HTTP/2. Ingress has path-based routing to /api/* and a specific POST route for /api/upload. Problem reported in production under moderate load.
Symptoms
Some POST requests to /api/upload return 404 from the ingress controller while identical GET requests to the same path succeed. Clients using HTTP/2 to the edge show higher incidence; curl with --http2 sometimes reproduces 404s while curl --http1.1 succeeds consistently. Retries or re-sending the same request over HTTP/1.1 resolves the problem.
Observations
Ingress controller logs show 'no matching location' for some POST requests; access logs indicate these 404s are handled by the ingress-nginx process rather than forwarded to upstream. When inspecting request headers, the 404 cases show the :method pseudo-header present and sometimes the ':authority' header differs (contains port or different host) compared to successful requests. Reproduced with HTTP/2 prior knowledge and with h2c via ALB passthrough — pattern persists. Disabling HTTP/2 at the edge removes the 404 occurrences. No Ingress rewrite rules intentionally filter by method.
Already attempted
Upgraded ingress-nginx to latest patch version, tested ingress annotations to disable http2 on the ingress controller, added server-snippet to explicitly pass through all methods — temporary mitigation successful. Captured tcpdump of the fronting proxy to compare pseudo-headers between successful and failing requests. Tried removing custom NGINX snippets and using default configuration — issue still appears when HTTP/2 to edge is enabled. Disabled enable-http2 on the controller and the problem stops.
Question
Why is the ingress-nginx controller returning 404 for POST requests only when the client connects with HTTP/2, and what is the safest way to restore correct handling of HTTP/2 POSTs without disabling HTTP/2 at the edge or rolling back ingress controller upgrades?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Cloud Computing40% match
Kubernetes Ingress returns 404 only for external gRPC clients behind cloud load balancer
Open0 answers - Cloud Computing36% match
Kubernetes admission webhook causes API server 404s for gRPC services only when behind AWS NLB with proxy-protocol enabled
Open0 answers - Databases29% match
PostgreSQL refuses new clients with 'too many connections' after scaling Node workers
Open1 answer - Web Development27% match
Nginx returns 504 Gateway Timeout only for backend requests over ~45s to my Node API
Open1 answer - Web Development26% match
NGINX returns 413 for Transfer-Encoding: chunked uploads only when proxying to Node.js over HTTP/2 TLS offload
Solved1 answer