Hello Myra,
Thank you for posting your question on the Microsoft Windows Forum!
The error:
upstream sent too big header
typically occurs when the response headers returned by the upstream application exceed the default NGINX buffer limits. Large JWT tokens stored in headers or cookies are a common cause of this issue.
To resolve it, increase the buffer sizes in your NGINX configuration.
Recommended Configuration
Edit your NGINX configuration file and add or update the following settings:
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
If the JWT token is being passed in request headers, you may also need:
large_client_header_buffers 4 64k;
Apply the Changes
- Validate the configuration:
nginx -t
- Reload NGINX:
nginx -s reload
or on Linux:
systemctl reload nginx
Additional Recommendation
While increasing the buffer size resolves the immediate issue, consider reviewing the JWT payload itself. Extremely large JWTs often indicate that too many claims, roles, or permissions are being stored in the token. Reducing token size can help improve performance and avoid similar header size issues in the future.
Verify the Fix
After applying the changes:
- Retry the request that was failing.
- Check the NGINX error log for new occurrences of:
upstream sent too big header
For additional reference:
https://nginx.org/en/docs/http/ngx_http_proxy_module.html
https://nginx.org/en/docs/http/ngx_http_core_module.html#large_client_header_buffers
I hope this answer has brought you useful information. If so, please click on Accept Answer. Doing so helps other community members identify useful solutions to similar issues.