koel/.htaccess

110 lines
4.4 KiB
ApacheConf
Raw Normal View History

2015-12-13 04:42:28 +00:00
<IfModule mod_headers.c>
2016-07-08 01:19:49 +00:00
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header always set Access-Control-Allow-Headers "Authorization,X-Accept-Charset,X-Accept,Content-Type"
2015-12-13 04:42:28 +00:00
</IfModule>
<IfModule mod_rewrite.c>
2016-07-08 01:19:49 +00:00
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
2015-12-13 04:42:28 +00:00
2016-07-08 01:19:49 +00:00
RewriteEngine On
RewriteBase /
2015-12-13 04:42:28 +00:00
2016-07-08 01:19:49 +00:00
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
2015-12-13 04:42:28 +00:00
# Whitelist only index.php, robots.txt, and some special routes
2019-03-13 07:21:56 +00:00
RewriteRule ^(?!($|index\.php|robots\.txt|(public|api)/|remote|api-docs|sw\.js)) - [R=404,L]
2016-06-09 17:11:46 +00:00
2016-07-08 01:19:49 +00:00
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php [L]
2015-12-29 01:35:22 +00:00
2016-07-08 01:19:49 +00:00
# https://github.com/tymondesigns/jwt-auth/wiki/Authentication
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
2015-12-13 04:42:28 +00:00
</IfModule>
2016-07-08 01:19:49 +00:00
<IfModule mod_expires.c>
2018-04-14 20:51:09 +00:00
# Cache the audio and other static files.
2016-07-08 01:19:49 +00:00
# It's up to the browser to respect this.
ExpiresActive On
2018-04-14 20:51:09 +00:00
ExpiresByType audio/mp3 "access plus 1 year"
ExpiresByType audio/mpg "access plus 1 year"
ExpiresByType audio/mpeg "access plus 1 year"
ExpiresByType audio/ogg "access plus 1 year"
ExpiresByType audio/aac "access plus 1 year"
ExpiresByType audio/m4a "access plus 1 year"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType font/ttf "access plus 1 month"
ExpiresByType font/woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
2015-12-13 04:42:28 +00:00
</IfModule>
2016-01-14 03:28:58 +00:00
2016-07-08 01:19:49 +00:00
<IfModule mod_deflate.c>
# Disable deflation for media files.
SetEnvIfNoCase Request_URI "^/api/play/" no-gzip dont-vary
# ----------------------------------------------------------------------
# Gzip compression.
# Stolen from https://github.com/h5bp/server-configs-apache/
# ----------------------------------------------------------------------
# Force compression for mangled `Accept-Encoding` request headers
# https://developer.yahoo.com/blogs/ydn/pushing-beyond-gzipping-25601.html
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
# Compress all output labeled with one of the following MIME-types
<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>
2016-01-14 03:28:58 +00:00
</IfModule>