Last active
September 11, 2020 21:40
-
-
Save 8ctopotamus/31c39b674ff7d4e46f7356cf719e0f5f to your computer and use it in GitHub Desktop.
Leverage Browser Caching Gzip all the things
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
| # Headers for Mozilla Observatory test # | |
| Header always set Strict-Transport-Security "max-age=31536000" env=HTTPS | |
| Header set X-XSS-Protection "1; mode=block" | |
| Header set X-Content-Type-Options nosniff | |
| Header always set X-Frame-Options "SAMEORIGIN" | |
| Header always set Referrer-Policy: no-referrer-when-downgrade | |
| Header set Feature-Policy "vibrate none; | |
| # START EXPIRES CACHING # | |
| ExpiresActive On | |
| ExpiresByType text/css "access 1 month" | |
| ExpiresByType text/html "access 1 month" | |
| ExpiresByType image/gif "access 1 year" | |
| ExpiresByType image/png "access 1 year" | |
| ExpiresByType image/jpg "access 1 year" | |
| ExpiresByType image/jpeg "access 1 year" | |
| ExpiresByType image/x-icon "access 1 year" | |
| ExpiresByType application/pdf "access 1 month" | |
| ExpiresByType application/javascript "access 1 month" | |
| ExpiresByType text/x-javascript "access 1 month" | |
| ExpiresByType application/x-shockwave-flash "access 1 month" | |
| ExpiresDefault "access 1 month" | |
| # END EXPIRES CACHING # | |
| # BEGIN Cache-Control Headers | |
| <ifModule mod_headers.c> | |
| <filesMatch "\.(ico|jpe?g|png|gif|swf)$"> | |
| Header set Cache-Control "public" | |
| </filesMatch> | |
| <filesMatch "\.(css)$"> | |
| Header set Cache-Control "public" | |
| </filesMatch> | |
| <filesMatch "\.(js)$"> | |
| Header set Cache-Control "private" | |
| </filesMatch> | |
| <filesMatch "\.(x?html?|php)$"> | |
| Header set Cache-Control "private, must-revalidate" | |
| </filesMatch> | |
| </ifModule> | |
| # END Cache-Control Headers | |
| # BEGIN Turn ETags Off | |
| FileETag None | |
| # END Turn ETags Off | |
| # BEGIN GZIP COMPRESSION | |
| <IfModule mod_gzip.c> | |
| mod_gzip_on Yes | |
| mod_gzip_dechunk Yes | |
| mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ | |
| mod_gzip_item_include handler ^cgi-script$ | |
| mod_gzip_item_include mime ^text/.* | |
| mod_gzip_item_include mime ^application/x-javascript.* | |
| mod_gzip_item_exclude mime ^image/.* | |
| mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* | |
| </IfModule> | |
| # END GZIP COMPRESSION | |
| # BEGIN DEFLATE COMPRESSION | |
| <IfModule mod_filter.c> | |
| AddOutputFilterByType DEFLATE "application/atom+xml" \ | |
| "application/javascript" \ | |
| "application/json" \ | |
| "application/ld+json" \ | |
| "application/manifest+json" \ | |
| "application/rdf+xml" \ | |
| "application/rss+xml" \ | |
| "application/schema+json" \ | |
| "application/vnd.geo+json" \ | |
| "application/vnd.ms-fontobject" \ | |
| "application/x-font-ttf" \ | |
| "application/x-javascript" \ | |
| "application/x-web-app-manifest+json" \ | |
| "application/xhtml+xml" \ | |
| "application/xml" \ | |
| "font/eot" \ | |
| "font/opentype" \ | |
| "image/bmp" \ | |
| "image/svg+xml" \ | |
| "image/vnd.microsoft.icon" \ | |
| "image/x-icon" \ | |
| "text/cache-manifest" \ | |
| "text/css" \ | |
| "text/html" \ | |
| "text/javascript" \ | |
| "text/plain" \ | |
| "text/vcard" \ | |
| "text/vnd.rim.location.xloc" \ | |
| "text/vtt" \ | |
| "text/x-component" \ | |
| "text/x-cross-domain-policy" \ | |
| "text/xml" | |
| </IfModule> | |
| # END DEFLATE COMPRESSION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment