Created
November 10, 2019 15:28
-
-
Save jdefez/e2f0ff11ef8115f9e8143b78370ec5fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RewriteEngine on | |
| RewriteCond %{HTTP:X-Forwarded-Port} ^80$ | |
| RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
| # Serve the file if it's actually a file on the server | |
| RewriteCond %{REQUEST_FILENAME} -s [OR] | |
| RewriteCond %{REQUEST_FILENAME} -l [OR] | |
| RewriteCond %{REQUEST_FILENAME} -d | |
| RewriteRule ^.*$ - [NC,L] | |
| # If not rewrite the uri to serve index.html | |
| RewriteRule ^(.*) /index.html | |
| # if we're serving index.html, set CACHEBUSTER environement | |
| SetEnvIf Request_URI "^/index.html$" CACHEBUSTER=true | |
| # if we're hitting on the root too | |
| SetEnvIf Request_URI "^/$" CACHEBUSTER=true | |
| # And add cache busting headers if the environment is CACHEBUSTER | |
| Header unset ETag env=CACHEBUSTER | |
| Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" env=CACHEBUSTER | |
| Header set Pragma "no-cache" env=CACHEBUSTER | |
| Header set Expires "Wed, 11 Jan 1986 05:00:00 GMT" env=CACHEBUSTER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment