Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mchev's avatar

AddLinkHeadersForPreloadedAssets causes 502 Bad Gateway

On a Laravel / Inertia / Vuejs project I'm having 502 issues on production only :

upstream sent too big header while reading response header from upstream

It seems that the issue comes from the AddLinkHeadersForPreloadedAssets middleware. I had to disable it. Should i increase the chunks size on vite config or this is it a dirty fix for a depper issue ?

0 likes
1 reply
JussiMannisto's avatar

If you have enough preloaded assets, the header size will exceed Nginx's default buffer size of 8 KB. You can increase the buffer size and restart Nginx, e.g.

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;

These are just values from my local config. Adjust them as needed.

Please or to participate in this conversation.