Nginx Too Big Header

I recently encountered an issue where one of the pages for allwin.co resulted in a

502 Bad Gateway error

After looking at the nginx logs, I could see that it was due to that specific page processing ending in upstream sent too big header while reading response header from upstream.

I understood the issue, but, I couldn't figure out "why?". Why something happened on that page and not on others. Especially as things being simple, I didn't have to manipulate the http headers of the response at all.

I quickly found an answer as how to fix, adding the following lines to nginx configuration:

location ~ \.php$ { 
	# ...
	fastcgi_buffers 16 16k;
	fastcgi_buffer_size 32k;
    #...
}

But still, why? why is it happening?

I could update the configuration blindly, but, acting on the production environment, I like to understand all configuration changes. As such, back to the question : why is it happening?

I found my answer looking at the headers from a different page. One that worked. The Link header ... I started the project using Laravel Breeze with Inertia, React and SSR enabled. By default, all js assets are broken down into their own files. And a link to each component file was present in the header... And for that specific page, it meant a long list bringing the header length over the limit.

There it is, the reason why ... so, configuration updated and I know why.

If you are in the same context, you may now know why as well. If you have the issue, look at the headers of a page that works what may make it too big in a different context.