yireo / Yireo_LinkPreload

Magento 2 extension to set HTTP Link headers for primary resources to allow for HTTP/2 Server Push
Open Software License 3.0
74 stars 18 forks source link

upstream sent too big header while reading response header from upstream #46

Open indykoning opened 1 month ago

indykoning commented 1 month ago

Once installed, on certain pages Nginx will throw upstream sent too big header while reading response header from upstream and cause 502s. After looking into it, this module might have a hand in it due to the amount of links it can add in a bloated Magento install.

I've ran into it myself making a similar extension for Laravel. My solution was to implement a configurable size limit which removes links until the size limit is reached. https://github.com/justbetter/laravel-http3earlyhints/blob/76f012e994cabde3b8f4c75889704546747ae760/src/Middleware/AddHttp3EarlyHints.php#L149

I think this might be a nice solution for this package as well

jissereitsma commented 1 month ago

I hate to say this, but this makes zero sense to me. The addition of this module is to enhance performance. If an Nginx configuration is not allowing large headers, then either this module needs to be skipped because apparently the webserver does not allow for tuning this, or the webserver needs to be tuned. There are more instances where Magento adds big headers - for instance CSP or CORS - and to hack the headers half-half seems like a worse solution. I don't think this change will make sense. And it will make support a hell ("why are part of the link-headers missing").