From 960817e9fe9a0a86cef1f80979c1a2326916a1e4 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 26 Sep 2021 07:12:02 -0500 Subject: [PATCH] posts: don't send cookies for thumbnail requests. Set `crossorigin="anonymous"` on the tag for thumbnails. This makes it so we don't send session cookies in requests for thumbnails. Since images are served from cdn.donmai.us, and since session cookies are set on *.donmai.us, session cookies are sent by default with every thumbnail request. Not sending cookies saves up to 1kb of overhead per thumbnail request (in reality, it's less than this because of HTTP/2 multiplexing and header compression). --- .../post_preview_component/post_preview_component.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/post_preview_component/post_preview_component.html.erb b/app/components/post_preview_component/post_preview_component.html.erb index c6ce94753..3e060d187 100644 --- a/app/components/post_preview_component/post_preview_component.html.erb +++ b/app/components/post_preview_component/post_preview_component.html.erb @@ -3,7 +3,7 @@ <%= tag.picture do -%> <%= tag.source media: "(max-width: 660px)", srcset: cropped_url -%> <%= tag.source media: "(min-width: 660px)", srcset: post.preview_file_url -%> - <%= tag.img class: "has-cropped-#{post.has_cropped?}", src: post.preview_file_url, style: "min-width: #{preview_dimensions[:width]}px; min-height: #{preview_dimensions[:height]}px;", title: tooltip, alt: "post ##{post.id}" -%> + <%= tag.img class: "has-cropped-#{post.has_cropped?}", src: post.preview_file_url, style: "min-width: #{preview_dimensions[:width]}px; min-height: #{preview_dimensions[:height]}px;", title: tooltip, alt: "post ##{post.id}", crossorigin: "anonymous" -%> <% end -%> <% end -%> <% if pool -%>