DEV Community

Cover image for Incident note: nginx: upstream sent too big header – fix
Daniele Michelin
Daniele Michelin

Posted on Originally published at daniele-michelin.com

Incident note: nginx: upstream sent too big header – fix

Read the signal

Start with the exact wording of the error and its timestamp in the log. Then narrow down the cause before changing anything.

2026/10/23 08:47:55 [error] 1234#1234: *7890 upstream sent too big header while reading response header from upstream, client: 198.51.100.7, server: cloud.beispiel.de, request: "GET /apps/user_saml/saml/acs HTTP/2.0"
Enter fullscreen mode Exit fullscreen mode

Narrow down possible causes

  • Large or many Set-Cookie headers, typical after SSO logins (SAML, OIDC) with long tokens.
  • Long Content-Security-Policy or Link headers.
  • Default 4 KB / 8 KB buffers (fastcgi_buffer_size, proxy_buffer_size) are too small.
  • Application debug output ends up in headers.

Check before changing anything

1.

Find the error in the nginx log

grep 'too big header' /var/log/nginx/error.log | tail -n 5
Enter fullscreen mode Exit fullscreen mode

2.

Measure the response header size

curl -s -o /dev/null -w '%{size_header}\n' https://cloud.example.com/
Enter fullscreen mode Exit fullscreen mode

3.

Look at the full headers

curl -sI https://cloud.example.com/login
Enter fullscreen mode Exit fullscreen mode

4.

Show current buffer settings

nginx -T 2>/dev/null | grep -E 'fastcgi_buffer|proxy_buffer'
Enter fullscreen mode Exit fullscreen mode

Fix and test again

  1. For PHP-FPM: fastcgi_buffer_size 32k; and fastcgi_buffers 16 16k; in the matching location block.
  2. For a reverse proxy: proxy_buffer_size 16k;, proxy_buffers 8 16k;, proxy_busy_buffers_size 32k;.
  3. Apply with nginx -t && systemctl reload nginx.
  4. Reduce unnecessary or duplicate cookies in the application.

Then repeat the original action and compare the result with the initial error.

Keep a note for the next ticket

Record the exact error, the check result, the change and the retest. That gives the team a useful starting point next time.

Why does it only happen after the SSO login?

On the redirect back from the identity provider the application sets several session and SAML cookies at once. That one response overflows the buffer.

Full error guide: nginx: upstream sent too big header while reading response header


Originally published at daniele-michelin.com. More guides, free checks (SPF, TLS, headers) and an error-message lexicon: daniele-michelin.com/en/.

Top comments (0)