Cloud Computing

Kubernetes Ingress returns 404 for POST requests only when client uses HTTP/2 to the edge (ingress-nginx misroutes upgraded requests)

Environment

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

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

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

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

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?

COMMUNITY RESPONSES

Verified community troubleshooting

0 replies

No answers yet..

Showing 0 of 0 community responses
AI DIAGNOSTICS

Incident analysis

Updated 1mo ago• Trouble ID

Most likely causes

Ingress controller (nginx) misinterprets HTTP/2 pseudo-headers when client connects over h2; :authority value differs (includes port or case difference) causing host/path-based ingress rule mismatch 70%
Fronting load balancer or proxy alters the :path or :authority during HTTP/2->HTTP/1.1 translation (e.g., not normalizing encoded characters), producing non-matching path for Ingress rules 55%
Ingress-nginx configuration snippet or custom middleware strips or rewrites method/pseudo-headers for HTTP/2 leading to route lookup failure for POST specifically 30%

Summary

When clients connect with HTTP/2, requests include pseudo-headers (:method, :scheme, :authority, :path). In some controller or config paths, the mapping from HTTP/2 pseudo-headers to NGINX variables used for routing can differ or be altered by edge proxies, causing mismatches against ingress rules which often rely on host/path. If :authority or path normalization changes (e.g., port appended), the ingress controller may not match the configured host/path and return 404. The fact that disabling HTTP/2 at the edge stops the problem implicates header translation or ALPN proxying behavior between edge and ingress-nginx.

Suggested Fixes

Diagnostic step 1
Temporarily disable HTTP/2 on the fronting ALB or proxy to confirm mitigation (you have done this). While disabled, capture full request flows with both HTTP/2 and HTTP/1.1 for comparison using tcpdump or proxy traces to see exact :authority and :path differences.
Diagnostic step 2
Check ingress rules for exact host/path matching; add an ingress rule or annotation to accept both host variants (with and without port) or normalize host headers using nginx ingress config-snippets to trim port from Host before matching. This is reversible by removing snippets if problematic.
Diagnostic step 3
Upgrade ingress-nginx to the latest patch release if not already done; review controller changelog for HTTP/2 pseudo-header fixes. Test the upgrade in staging with HTTP/2 enabled to see if the regression is already patched.

Continue troubleshooting

Matched from the title, description and tags