Skip to content

Troubleshooting error 502 "upstream sent too big header while reading response header from upstream" #676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

sushicodeur
Copy link
Contributor

No description provided.

…eader while reading response header from upstream"

# Bigger buffer size to handle cache invalidation headers expansion
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value used here for fastcgi_buffers seems very atypical, and is probably a complete overkill for most cases.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you suggest to use a lower value by default? The size of header can grow very fastly when the invalidation mechanism is enabled...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 32k is enough in most of case, 256k seems very very high.

Copy link
Contributor

@teohhanhui teohhanhui Dec 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like:

fastcgi_buffer_size 32k;
fastcgi_buffers 8 16k;

(Copied from somewhere around the Internet lol)

@dunglas:

The size of header can grow very fastly when the invalidation mechanism is enabled...

We often forget how big a kilobyte actually is when it comes to text. 😄

Copy link
Contributor

@teohhanhui teohhanhui Dec 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the response header grows past 32 KB because of the cache tags, I think it's a feature for it to not work, because you have a very serious problem. 😆

Assuming each cache tag is a pretty long IRI of 100 characters each, that'd take more than 300 IRIs... You're likely to run into api-platform/api-platform#721 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for this strange buffer values, it doesn't mean a lot to me, so I though the bigger the better :)

Should this troubleshooting put an accent on the shortName annotation to have shorter urls as a way to reduce the size of sent headers ?

@dunglas
Copy link
Member

dunglas commented Dec 20, 2018

Merging as is, lets tweak the value in a next PR.

@dunglas dunglas merged commit 4f05537 into api-platform:2.3 Dec 20, 2018
@dunglas
Copy link
Member

dunglas commented Dec 20, 2018

Thanks @sushicodeur!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants