Skip to content

Instantly share code, notes, and snippets.

@alexdiliberto
Last active March 12, 2018 22:52
Show Gist options
  • Save alexdiliberto/c7219802342a8c0429a5a28fff4b42a1 to your computer and use it in GitHub Desktop.
Save alexdiliberto/c7219802342a8c0429a5a28fff4b42a1 to your computer and use it in GitHub Desktop.
Example vhosts.conf
// Re: busting the cache when using service worker
// The service worker JS name isn't fingerprinted, so if it has cache headers, it won't be updated and then none of your
// assets will be updated (because they're cached by the service worker for offline access). This is one technique for
// caching headers to ensure you're only caching fingerprinted assets
<VirtualHost *:8080>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/Users/martndemus/Projects/DockYard/smart-shopping-list/dist"
ServerName localhost
<Directory "/Users/martndemus/Projects/DockYard/smart-shopping-list/dist">
AllowOverride All
Require all granted
Header unset ETag
FileETag None
Header set Cache-Control "no-cache"
Header set Expires "Thu, 01 Jan 1970 00:00:01 GMT"
<FilesMatch "-[a-z0-9]{32}.(js|css|png|webmanifest)$">
Header set Cache-Control "max-age=31536000, public"
ExpiresActive On
ExpiresDefault "access plus 1 year"
</FilesMatch>
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment