Skip to content

Commit

Permalink
update htaccess from agentejo/cockpit#1404
Browse files Browse the repository at this point in the history
  • Loading branch information
Raruto committed Feb 6, 2021
1 parent 0821b22 commit 0951b65
Showing 1 changed file with 86 additions and 47 deletions.
133 changes: 86 additions & 47 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@
# Apache/PHP/Cockpit settings:
#

# ----------------------------------------------------------------------
# File access
# ----------------------------------------------------------------------

# Deny access to application and system files from being viewed
<FilesMatch "(composer\.(json|lock)|package\.json|(README|CONTRIBUTING)\.md|cp|Dockerfile|LICENSE|\.(sqlite|sdb|s3db|db|yaml|yml))$">
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Deny from all
</IfVersion>
<IfVersion >= 2.4>
Require all denied
</IfVersion>
<IfVersion < 2.4>
Deny from all
</IfVersion>
</FilesMatch>

# Disable directory listings
Options -Indexes

# ----------------------------------------------------------------------
# Rewrite Engine
# ----------------------------------------------------------------------

# Requires mod_rewrite to be enabled
<IfModule mod_rewrite.c>

Expand Down Expand Up @@ -42,43 +50,68 @@ Options -Indexes

</IfModule>

# ----------------------------------------------------------------------
# Charset encoding
# ----------------------------------------------------------------------

# Serve all `text/html` and `text/plain` file with UTF-8 charset
AddDefaultCharset utf-8

AddType application/javascript js jsonp tag
AddType application/json json

# Audio
AddType audio/ogg oga ogg
AddType audio/mp4 m4a f4a f4b

# Video
AddType video/ogg ogv
AddType video/mp4 mp4 m4v f4v f4p
AddType video/webm webm
AddType video/x-flv flv

# SVG
# Required for svg webfonts on iPad
# twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
AddEncoding gzip svgz

# Webfonts
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
AddType application/x-font-woff woff

# Assorted types
AddType image/x-icon ico
AddType image/webp webp
AddType text/cache-manifest appcache manifest
AddType text/x-component htc
AddType application/xml rss atom xml rdf
AddType text/x-vcard vcf
AddType application/x-shockwave-flash swf
# ----------------------------------------------------------------------
# MIME Types
# ----------------------------------------------------------------------

# Requires mod_mime to be enabled
<IfModule mod_mime.c>

# Serve resources with the proper media types (MIME types)

# Javascript
AddType application/javascript js jsonp tag
AddType application/json json

# Audio
AddType audio/ogg oga ogg
AddType audio/mp4 m4a f4a f4b

# Video
AddType video/ogg ogv
AddType video/mp4 mp4 m4v f4v f4p
AddType video/webm webm
AddType video/x-flv flv

# SVG
# Required for svg webfonts on iPad
# twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
AddEncoding gzip svgz

# Webfonts
AddType application/vnd.ms-fontobject eot
AddType application/x-font-ttf ttf ttc
AddType font/opentype otf
AddType application/x-font-woff woff

# Assorted types
AddType image/x-icon ico
AddType image/webp webp
AddType text/cache-manifest appcache manifest
AddType text/x-component htc
AddType application/xml rss atom xml rdf
AddType text/x-vcard vcf
AddType application/x-shockwave-flash swf

</IfModule>

# ----------------------------------------------------------------------
# Cache Expiration
# ----------------------------------------------------------------------

# Requires mod_expires to be enabled
<IfModule mod_expires.c>

# Serve resources with a far-future expiration date.

ExpiresActive On

ExpiresByType application/pdf "access plus 1 year"
Expand Down Expand Up @@ -113,17 +146,26 @@ AddType application/x-shockwave-flash swf
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType text/ecmascript "access plus 1 year"
ExpiresByType text/javascript "access plus 1 year"

</IfModule>

# -------------------------------------------------------------------------
# Disabling ETags as they are most likely misconfigured and
# do not add functionality beyond Last-Modified
# -------------------------------------------------------------------------
# ----------------------------------------------------------------------
# ETags
# ----------------------------------------------------------------------

# Remove ETags as resources are sent with far-future expires headers.
FileETag None

# Requires mod_headers to be enabled
<IfModule mod_headers.c>
# Try removing etag headers (if it's coming from proxy for example)
Header unset ETag
</IfModule>

# -------------------------------------------------------------------------
# Compression
# -------------------------------------------------------------------------

# Requires mod_expires to be enabled
<IfModule mod_deflate.c>

# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
Expand Down Expand Up @@ -158,6 +200,3 @@ AddType application/x-shockwave-flash swf
</IfModule>

</IfModule>

# Remove ETags
FileETag None

0 comments on commit 0951b65

Please sign in to comment.