Tell browsers they can use stale tiles
authorTom Hughes <tom@compton.nu>
Fri, 22 Nov 2019 17:06:59 +0000 (17:06 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 22 Nov 2019 17:07:29 +0000 (17:07 +0000)
cookbooks/tile/templates/default/apache.erb

index 8df11453b66850799e2ce63c65145801e709e894..e5d7f17192bbca6ebb7b2987e40da32a038a254e 100644 (file)
@@ -40,6 +40,9 @@
   # Add diagnostics header to identify render server
   Header set X-TileRender "<%= node.name %>"
 
+  # Tell clients to use stale tiles if necessary
+  Header append Cache-Control "stale-while-revalidate=604800, stale-if-error=604800" "expr=%{CONTENT_TYPE} == 'image/png'"
+
   # Remove Proxy request header to mitigate https://httpoxy.org/
   RequestHeader unset Proxy early