Request on k8s NGINX ingress controller fails with "upstream sent too big header while reading response header from upstream"

7/26/2021

When I try to send a request through my NGINX ingress with headers larger than 4k, it returns a 502 error:

[error] 39#39: *356 upstream sent too big header while reading response header from upstream, 
    client: <ip>,
    server: <server>, 
    request: "GET /path/ HTTP/1.1", 
    subrequest: "/_external-auth-Lw", 
    upstream: "<uri>", 
    host: "<host>"
[error] 39#39: *356 auth request unexpected status: 502 while sending to client, 
    client: <ip>, 
    server: <server>, 
    request: "GET /path/ HTTP/1.1", 
    host: "<host>"

I've followed instructions about how to allegedly resolve this issue by configuring the proxy-buffer-size in the ingress controller (nginx.ingress.kubernetes.io/proxy-buffer-size: "16k"), but it doesn't seem to work. The only thing that I can think of, is that it has something to do with the proxy-buffer-size of the subrequest, which doesn't seem to get set.

-- kellanburket
kubernetes
nginx
nginx-ingress

1 Answer

7/27/2021

The proxy_buffering header wasn't being set on the /_external-auth-Lw endpoint in the NGINX config. Issue has been resolved as of v. 0.14.0.

-- kellanburket
Source: StackOverflow