LinusPhoenix / raidsimp

World of Warcraft Raid Team Manager
https://raidsimp.com
MIT License
4 stars 0 forks source link

Set an explicit caching policy #21

Closed karifrederiksen closed 2 years ago

karifrederiksen commented 2 years ago

Caddy has some default caching which leads to people having to force-clear their browser caches for every release.

Caching is fine for assets that include hashes in their names, such as the Javascript chunks. Caching images is probably fine for now since we never edit them - we can start hashing images once we start editing them.

index.html on the other hand can't be hashed since it is referred to by name in the Caddyfile, and since we can't add a hash to its name and it's the root of our application, we must disable caching for it. Maybe stale-while-revalidate is appropriate though.

LinusPhoenix commented 2 years ago

Let's try it first by adding the Cache-Control header in the Caddyfile for frontend requests, with the value max-age=259200, stale-while-revalidate.

karifrederiksen commented 2 years ago

Did you add the header? It's not in /frontend/caddy/Caddyfile on the dev branch.

LinusPhoenix commented 2 years ago

No, I did not

LinusPhoenix commented 2 years ago

I went ahead with setting Cache-Control response headers in Caddy with the following behavior:

LinusPhoenix commented 2 years ago

Released in 1.0.0