Consider cache-control: public for /assets #10600

Closed
opened 2025-11-02 09:12:20 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @silverwind on GitHub (Apr 6, 2023).

Feature Description

As requested on Discord, I think it makes sense to have the assets that have contenthash in their filename cacheable by intermediary proxies via cache-control: public to take off some load from the gitea process.

For files that do not have contenthash like serviceworker.js and more, I'm not sure. I think we may have to exclude them or (ideally) change them to have a contenthash.

Also I do think we can raise the default cache duration for contenthash assets significantly. They are essentially immutable.

Originally created by @silverwind on GitHub (Apr 6, 2023). ### Feature Description As requested on Discord, I think it makes sense to have the assets that have `contenthash` in their filename cacheable by intermediary proxies via `cache-control: public` to take off some load from the gitea process. For files that do not have `contenthash` like `serviceworker.js` and more, I'm not sure. I think we may have to exclude them or (ideally) change them to have a `contenthash`. Also I do think we can raise the default cache duration for `contenthash` assets significantly. They are essentially immutable.
GiteaMirror added the performance/cputype/enhancementtype/proposal labels 2025-11-02 09:12:20 -06:00
Author
Owner

@silverwind commented on GitHub (Apr 8, 2023):

If serviceworker.js is the last holdout without contenthash, I would consider removing it. It serves no real purpose for Gitea, except being a unnecessary cache layer, while browser HTTP cache already works.

@silverwind commented on GitHub (Apr 8, 2023): If `serviceworker.js` is the last holdout without contenthash, I would consider removing it. It serves no real purpose for Gitea, except being a unnecessary cache layer, while browser HTTP cache already works.
Author
Owner

@wxiaoguang commented on GitHub (Apr 23, 2025):

We have it now

Image

@wxiaoguang commented on GitHub (Apr 23, 2025): We have it now ![Image](https://github.com/user-attachments/assets/67972d39-6e94-4b51-ae7e-e1e610fb0b47)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10600