Disable sending of Link header in preload_link_tag
What does this MR do and why?
Even though ActionView::Helpers::AssetTagHelper.preload_links_header
is set to false, preload_link_tag
sends the Link header if the total
header size to send is under 8K. However, this causes HTTP responses
to fail in NGINX if the default proxy_buffer_size
is set too low.
Ironically because app/views/layouts/_loading_hints.html.haml
is a
cached partial, preload_link_tag
generates the HTML, but only
actually sends the Link
header once a minute when the cache expires.
This suggests that the Link
header isn't really helping much, and
causes more trouble than it's worth.
Rails 7.1 lowered the preload_link_tag
limit to 1000 bytes in
https://github.com/rails/rails/pull/48405, but that may not be
sufficient.
https://github.com/rails/rails/issues/51436 proposes to disable the sending of the Link header entirely. This patch does this by turning send_preload_links_header into a NOP.
We can probably drop this patch for Rails 7.1 and up, but we might
want to wait for https://github.com/rails/rails/pull/51441 or some
mechanism that can disable the Link
header.
Relates to #443866 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
- In your GDK, run
curl -s -o /dev/null -v https://gdk.test:3443/users/sign_in | grep Link
. - This should be blank, even trying again after minutes.