Gitea's avatar images are missing caching headers #312

Closed
opened 2021-02-25 18:42:17 +00:00 by raucao · 1 comment
Owner

Whenever I load a page on gitea.kosmos.org, it loads all images anew. Seems like the nginx host is missing config for static assets.

Whenever I load a page on gitea.kosmos.org, it loads all images anew. Seems like the nginx host is missing config for static assets.
raucao added the
service
gitea
label 2021-02-25 18:42:17 +00:00
raucao self-assigned this 2021-02-26 18:53:50 +00:00
Author
Owner

I had a look at this just now: normal static assets, like CSS files etc. carry expires and last-modified headers to at least cache them for 24 hours (albeit no ETAGs).

Other uploaded custom files, e.g. file attachments, come with a cache-control: public,max-age=86400, which also does what it's supposed to.

However, uploaded avatars specifically, both user/org and repo ones (which live in two different folders on the disk), are missing any and all caching headers.

So I think this should be fixed in Gitea itself. Otherwise we'll have to change permissions on the uploaded avatars, or add the nginx user to the git group, which seems like a bad idea to me.

I missed the obvious choice of using a regex location directive for adding custom caching headers for anything in the avatar folders. See PR.

I had a look at this just now: normal static assets, like CSS files etc. carry `expires` and `last-modified` headers to at least cache them for 24 hours (albeit no ETAGs). Other uploaded custom files, e.g. file attachments, come with a `cache-control: public,max-age=86400`, which also does what it's supposed to. However, uploaded avatars specifically, both user/org and repo ones (which live in two different folders on the disk), are missing any and all caching headers. <strike>So I think this should be fixed in Gitea itself. Otherwise we'll have to change permissions on the uploaded avatars, or add the nginx user to the `git` group, which seems like a bad idea to me.</strike> I missed the obvious choice of using a regex location directive for adding custom caching headers for anything in the avatar folders. See PR.
raucao changed title from Gitea's static assets like avatars not cached to Gitea's avatar images are missing caching headers 2021-02-26 18:59:36 +00:00
raucao added the
bug
label 2021-02-26 18:59:48 +00:00
greg closed this issue 2021-02-26 21:25:41 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: kosmos/chef#312
No description provided.