Skip to content

Commit 9864314

Browse files
committed
Prevent metadata caching
Add Apache .htaccess file to prevent browser caching of generated JSON metadata when deployed to our infrastructure. This is part of https://phabricator.wikimedia.org/T315643
1 parent 6657712 commit 9864314

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

public/.htaccess

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Prevent caching of JSON generated by banner-screenshots
2+
# The JSON is our "serverless API" and must therefore not be cached
3+
# Code inspired by https://www.a2hosting.com/kb/developer-corner/apache-web-server/turning-off-caching-using-htaccess
4+
#
5+
# This file will only work when hosted on an Apache web server, not in the dev environment
6+
<FilesMatch "(metadata_summary.json|metadata.json)$">
7+
<IfModule mod_expires.c>
8+
ExpiresActive Off
9+
</IfModule>
10+
<IfModule mod_headers.c>
11+
FileETag None
12+
Header unset ETag
13+
Header unset Pragma
14+
Header unset Cache-Control
15+
Header unset Last-Modified
16+
Header set Pragma "no-cache"
17+
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
18+
Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
19+
</IfModule>
20+
</FilesMatch>
21+

0 commit comments

Comments
 (0)