Skip to content
代码片段 群组 项目
  • Stan Hu's avatar
    76fe184e
    Disable sending of Link header in preload_link_tag · 76fe184e
    Stan Hu 创作于
    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 it
    can cause 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 https://gitlab.com/gitlab-org/gitlab/-/issues/443866
    
    Changelog: fixed
    未验证
    76fe184e
    历史
    Disable sending of Link header in preload_link_tag
    Stan Hu 创作于
    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 it
    can cause 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 https://gitlab.com/gitlab-org/gitlab/-/issues/443866
    
    Changelog: fixed
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。
application_controller_spec.rb 1.57 KiB