go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.2k stars 5.42k forks source link

Consider `cache-control: public` for `/assets` #23952

Open silverwind opened 1 year ago

silverwind commented 1 year ago

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.

silverwind commented 1 year ago

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.