static_cache_control.vcl 1.1 KB

123456789101112131415161718
  1. # This is needed because Rails does not properly set them
  2. # See https://github.com/mastodon/mastodon/issues/24021
  3. if (req.url.path == "/sw.js") {
  4. set beresp.http.Cache-Control = "public, max-age=300, stale-while-revalidate, immutable";
  5. } else if(req.url.path ~ "^/sounds/.+") {
  6. set beresp.http.Cache-Control = "public, max-age=3600, stale-while-revalidate, immutable";
  7. } else if(req.url.path ~ "^/avatars/.+") {
  8. set beresp.http.Cache-Control = "public, max-age=3600, stale-while-revalidate, immutable";
  9. } else if(req.url.path ~ "^/emoji/.+") {
  10. set beresp.http.Cache-Control = "public, max-age=3600, stale-while-revalidate, immutable";
  11. } else if(req.url.path ~ "^/shortcuts/.+") {
  12. set beresp.http.Cache-Control = "public, max-age=3600, stale-while-revalidate, immutable";
  13. } else if(req.url.path ~ "^/headers/.+") {
  14. set beresp.http.Cache-Control = "public, max-age=3600, stale-while-revalidate, immutable";
  15. } else if(req.url.path ~ "^/(robots\.txt|oops\.png|oops\.gif|inert\.css|favicon\.ico|embed\.js|badge\.png)$") {
  16. set beresp.http.Cache-Control = "public, max-age=3600, stale-while-revalidate, immutable";
  17. }