-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #28739: Fix static asset caching when using Puma
- Loading branch information
Showing
3 changed files
with
43 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Return compressed assets if they are precompiled | ||
<IfModule mod_rewrite.c> | ||
RewriteEngine on | ||
# Make sure the browser supports gzip encoding and file with .gz added | ||
# does exist on disc before we rewrite with the extension | ||
RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b | ||
RewriteCond %{REQUEST_FILENAME} \.(css|js|svg)$ | ||
RewriteCond %{REQUEST_FILENAME}.gz -s | ||
RewriteRule ^(.+) $1.gz [L] | ||
|
||
# Set headers for all possible assets which are compressed | ||
<FilesMatch \.css\.gz$> | ||
ForceType text/css | ||
Header set Content-Encoding gzip | ||
SetEnv no-gzip | ||
</FilesMatch> | ||
<FilesMatch \.js\.gz$> | ||
ForceType text/javascript | ||
Header set Content-Encoding gzip | ||
SetEnv no-gzip | ||
</FilesMatch> | ||
<FilesMatch \.svg\.gz$> | ||
ForceType image/svg+xml | ||
Header set Content-Encoding gzip | ||
SetEnv no-gzip | ||
</FilesMatch> | ||
</IfModule> | ||
|
||
<LocationMatch "^/(assets|webpack)"> | ||
Options SymLinksIfOwnerMatch | ||
AllowOverride None | ||
Require all granted | ||
|
||
# Use standard http expire header for assets instead of ETag | ||
<IfModule mod_expires.c> | ||
Header unset ETag | ||
FileETag None | ||
ExpiresActive On | ||
ExpiresDefault "access plus 1 year" | ||
</IfModule> | ||
</LocationMatch> |
This file contains 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
This file was deleted.
Oops, something went wrong.