Skip to content

Commit 9a176f5

Browse files
LeoColombroblarsen
authored andcommitted
Update .htaccess to v2.15.0 from h5bp/server-configs-apache (#2003)
1 parent b831c76 commit 9a176f5

File tree

2 files changed

+71
-47
lines changed

2 files changed

+71
-47
lines changed

dist/.htaccess

+70-46
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Apache Server Configs v2.14.0 | MIT License
1+
# Apache Server Configs v2.15.0 | MIT License
22
# https://github.com/h5bp/server-configs-apache
33

44
# (!) Using `.htaccess` files slows down Apache, therefore, if you have
55
# access to the main server configuration file (which is usually called
66
# `httpd.conf`), you should add this logic there.
77
#
8-
# https://httpd.apache.org/docs/current/howto/htaccess.html.
8+
# https://httpd.apache.org/docs/current/howto/htaccess.html
99

1010
# ######################################################################
1111
# # CROSS-ORIGIN #
@@ -18,8 +18,8 @@
1818
# Allow cross-origin requests.
1919
#
2020
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
21-
# http://enable-cors.org/
22-
# http://www.w3.org/TR/cors/
21+
# https://enable-cors.org/
22+
# https://www.w3.org/TR/cors/
2323

2424
# <IfModule mod_headers.c>
2525
# Header set Access-Control-Allow-Origin "*"
@@ -66,7 +66,7 @@
6666
# some of the attributes of the `PerformanceResourceTiming` object will
6767
# be set to zero.
6868
#
69-
# http://www.w3.org/TR/resource-timing/
69+
# https://www.w3.org/TR/resource-timing/
7070
# http://www.stevesouders.com/blog/2014/08/21/resource-timing-practical-tips/
7171

7272
# <IfModule mod_headers.c>
@@ -120,7 +120,7 @@ Options -MultiViews
120120
# consider enabling `Enterprise Mode` throughout your company.
121121
#
122122
# https://msdn.microsoft.com/en-us/library/ie/bg182625.aspx#docmode
123-
# http://blogs.msdn.com/b/ie/archive/2014/04/02/stay-up-to-date-with-enterprise-mode-for-internet-explorer-11.aspx
123+
# https://blogs.msdn.microsoft.com/ie/2014/04/02/stay-up-to-date-with-enterprise-mode-for-internet-explorer-11/
124124

125125
<IfModule mod_headers.c>
126126

@@ -130,7 +130,7 @@ Options -MultiViews
130130
# the `X-UA-Compatible` response header should be send only for
131131
# HTML documents and not for the other resources.
132132

133-
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
133+
<FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ic[os]|jpe?g|m?js|json(ld)?|m4[av]|manifest|map|markdown|md|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
134134
Header unset X-UA-Compatible
135135
</FilesMatch>
136136

@@ -143,7 +143,7 @@ Options -MultiViews
143143
# Allow cookies to be set from iframes in Internet Explorer.
144144
#
145145
# https://msdn.microsoft.com/en-us/library/ms537343.aspx
146-
# http://www.w3.org/TR/2000/CR-P3P-20001215/
146+
# https://www.w3.org/TR/2000/CR-P3P-20001215/
147147

148148
# <IfModule mod_headers.c>
149149
# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
@@ -180,7 +180,7 @@ Options -MultiViews
180180
# Normalize to standard type.
181181
# https://tools.ietf.org/html/rfc4329#section-7.2
182182

183-
AddType application/javascript js
183+
AddType application/javascript js mjs
184184

185185

186186
# Manifest files
@@ -203,28 +203,20 @@ Options -MultiViews
203203
AddType video/x-flv flv
204204

205205
# Serving `.ico` image files with a different media type
206-
# prevents Internet Explorer from displaying then as images:
206+
# prevents Internet Explorer from displaying them as images:
207207
# https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee
208208

209209
AddType image/x-icon cur ico
210210

211211

212212
# Web fonts
213213

214-
AddType application/font-woff woff
215-
AddType application/font-woff2 woff2
214+
AddType font/woff woff
215+
AddType font/woff2 woff2
216216
AddType application/vnd.ms-fontobject eot
217-
218-
# Browsers usually ignore the font media types and simply sniff
219-
# the bytes to figure out the font type.
220-
# https://mimesniff.spec.whatwg.org/#matching-a-font-type-pattern
221-
#
222-
# However, Blink and WebKit based browsers will show a warning
223-
# in the console if the following font types are served with any
224-
# other media types.
225-
226-
AddType application/x-font-ttf ttc ttf
227-
AddType font/opentype otf
217+
AddType font/ttf ttf
218+
AddType font/collection ttc
219+
AddType font/otf otf
228220

229221

230222
# Other
@@ -234,6 +226,8 @@ Options -MultiViews
234226
AddType application/x-chrome-extension crx
235227
AddType application/x-opera-extension oex
236228
AddType application/x-xpinstall xpi
229+
AddType text/calendar ics
230+
AddType text/markdown markdown md
237231
AddType text/vcard vcard vcf
238232
AddType text/vnd.rim.location.xloc xloc
239233
AddType text/vtt vtt
@@ -264,10 +258,14 @@ AddDefaultCharset utf-8
264258
.bbaw \
265259
.css \
266260
.geojson \
261+
.ics \
267262
.js \
268263
.json \
269264
.jsonld \
270265
.manifest \
266+
.markdown \
267+
.md \
268+
.mjs \
271269
.rdf \
272270
.rss \
273271
.topojson \
@@ -352,7 +350,7 @@ AddDefaultCharset utf-8
352350
# <IfModule mod_rewrite.c>
353351
# RewriteEngine On
354352
# RewriteCond %{HTTPS} !=on
355-
# RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
353+
# RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
356354
# </IfModule>
357355

358356
# ----------------------------------------------------------------------
@@ -366,20 +364,28 @@ AddDefaultCharset utf-8
366364
# one.
367365
#
368366
# By default `Option 1` (no `www.`) is activated.
369-
# http://no-www.org/faq.php?q=class_b
367+
# https://web.archive.org/web/20161122074017/http://no-www.org/faq.php?q=class_b
370368
#
371369
# If you would prefer to use `Option 2`, just comment out all the
372370
# lines from `Option 1` and uncomment the ones from `Option 2`.
373371
#
374372
# (!) NEVER USE BOTH RULES AT THE SAME TIME!
375373

374+
# (1) The two rules assume by default that both HTTP and HTTPS
375+
# environnements are available for redirection.
376+
# If your SSL certificate could not handle one of the domains
377+
# used during redirection, you should turn the condition on.
378+
#
379+
# https://github.com/h5bp/server-configs-apache/issues/52
380+
376381
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
377382

378383
# Option 1: rewrite www.example.com → example.com
379384

380385
<IfModule mod_rewrite.c>
381386
RewriteEngine On
382-
RewriteCond %{HTTPS} !=on
387+
# (1)
388+
# RewriteCond %{HTTPS} !=on
383389
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
384390
RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L]
385391
</IfModule>
@@ -393,7 +399,8 @@ AddDefaultCharset utf-8
393399

394400
# <IfModule mod_rewrite.c>
395401
# RewriteEngine On
396-
# RewriteCond %{HTTPS} !=on
402+
# # (1)
403+
# # RewriteCond %{HTTPS} !=on
397404
# RewriteCond %{HTTP_HOST} !^www\. [NC]
398405
# RewriteCond %{SERVER_ADDR} !=127.0.0.1
399406
# RewriteCond %{SERVER_ADDR} !=::1
@@ -436,7 +443,7 @@ AddDefaultCharset utf-8
436443
# https://cure53.de/xfo-clickjacking.pdf.
437444
#
438445
# https://tools.ietf.org/html/rfc7034
439-
# http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/combating-clickjacking-with-x-frame-options.aspx
446+
# https://blogs.msdn.microsoft.com/ieinternals/2010/03/30/combating-clickjacking-with-x-frame-options/
440447
# https://www.owasp.org/index.php/Clickjacking
441448

442449
# <IfModule mod_headers.c>
@@ -447,7 +454,7 @@ AddDefaultCharset utf-8
447454
# # the `X-Frame-Options` response header should be send only for
448455
# # HTML documents and not for the other resources.
449456

450-
# <FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
457+
# <FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ic[os]|jpe?g|m?js|json(ld)?|m4[av]|manifest|map|markdown|md|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
451458
# Header unset X-Frame-Options
452459
# </FilesMatch>
453460

@@ -470,9 +477,9 @@ AddDefaultCharset utf-8
470477
# To make things easier, you can use an online CSP header generator
471478
# such as: http://cspisawesome.com/.
472479
#
473-
# http://content-security-policy.com/
474-
# http://www.html5rocks.com/en/tutorials/security/content-security-policy/
475-
# http://www.w3.org/TR/CSP11/).
480+
# https://content-security-policy.com/
481+
# https://www.html5rocks.com/en/tutorials/security/content-security-policy/
482+
# https://w3c.github.io/webappsec-csp/
476483

477484
# <IfModule mod_headers.c>
478485

@@ -482,7 +489,7 @@ AddDefaultCharset utf-8
482489
# # the `Content-Security-Policy` response header should be send
483490
# # only for HTML documents and not for the other resources.
484491

485-
# <FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
492+
# <FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ic[os]|jpe?g|m?js|json(ld)?|m4[av]|manifest|map|markdown|md|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
486493
# Header unset Content-Security-Policy
487494
# </FilesMatch>
488495

@@ -535,15 +542,15 @@ AddDefaultCharset utf-8
535542
# left by some text editors and can pose a security risk when anyone
536543
# has access to them.
537544
#
538-
# http://feross.org/cmsploit/
545+
# https://feross.org/cmsploit/
539546
#
540547
# (!) Update the `<FilesMatch>` regular expression from below to
541548
# include any files that might end up on your production server and
542549
# can expose sensitive information about your website. These files may
543550
# include: configuration files, files that contain metadata about the
544551
# project (e.g.: project dependencies), build scripts, etc..
545552

546-
<FilesMatch "(^#.*#|\.(bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$">
553+
<FilesMatch "(^#.*#|\.(bak|conf|dist|fla|in[ci]|log|orig|psd|sh|sql|sw[op])|~)$">
547554

548555
# Apache < 2.3
549556
<IfModule !mod_authz_core.c>
@@ -577,9 +584,9 @@ AddDefaultCharset utf-8
577584
# (!) Remove the `includeSubDomains` optional directive if the website's
578585
# subdomains are not using HTTPS.
579586
#
580-
# http://www.html5rocks.com/en/tutorials/security/transport-layer-security/
587+
# https://www.html5rocks.com/en/tutorials/security/transport-layer-security/
581588
# https://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec-14#section-6.1
582-
# http://blogs.msdn.com/b/ieinternals/archive/2014/08/18/hsts-strict-transport-security-attacks-mitigations-deployment-https.aspx
589+
# https://blogs.msdn.microsoft.com/ieinternals/2014/08/18/strict-transport-security/
583590

584591
# <IfModule mod_headers.c>
585592
# Header always set Strict-Transport-Security "max-age=16070400; includeSubDomains"
@@ -596,8 +603,8 @@ AddDefaultCharset utf-8
596603
# is serving user-uploaded content or content that could potentially be
597604
# treated as executable by the browser.
598605
#
599-
# http://www.slideshare.net/hasegawayosuke/owasp-hasegawa
600-
# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
606+
# https://www.slideshare.net/hasegawayosuke/owasp-hasegawa
607+
# https://blogs.msdn.microsoft.com/ie/2008/07/02/ie8-security-part-v-comprehensive-protection/
601608
# https://msdn.microsoft.com/en-us/library/ie/gg622941.aspx
602609
# https://mimesniff.spec.whatwg.org/
603610

@@ -637,8 +644,8 @@ AddDefaultCharset utf-8
637644
# you are taking all possible measures to prevent XSS attacks, the
638645
# most obvious being: validating and sanitizing your website's inputs.
639646
#
640-
# http://blogs.msdn.com/b/ie/archive/2008/07/02/ie8-security-part-iv-the-xss-filter.aspx
641-
# http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx
647+
# https://blogs.msdn.microsoft.com/ie/2008/07/02/ie8-security-part-iv-the-xss-filter/
648+
# https://blogs.msdn.microsoft.com/ieinternals/2011/01/31/controlling-the-xss-filter/
642649
# https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29
643650

644651
# <IfModule mod_headers.c>
@@ -650,7 +657,7 @@ AddDefaultCharset utf-8
650657
# # the `X-XSS-Protection` response header should be send only for
651658
# # HTML documents and not for the other resources.
652659

653-
# <FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ico|jpe?g|js|json(ld)?|m4[av]|manifest|map|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
660+
# <FilesMatch "\.(appcache|atom|bbaw|bmp|crx|css|cur|eot|f4[abpv]|flv|geojson|gif|htc|ic[os]|jpe?g|m?js|json(ld)?|m4[av]|manifest|map|markdown|md|mp4|oex|og[agv]|opus|otf|pdf|png|rdf|rss|safariextz|svgz?|swf|topojson|tt[cf]|txt|vcard|vcf|vtt|webapp|web[mp]|webmanifest|woff2?|xloc|xml|xpi)$">
654661
# Header unset X-XSS-Protection
655662
# </FilesMatch>
656663

@@ -666,9 +673,9 @@ AddDefaultCharset utf-8
666673
# (e.g.: ASP.NET, PHP), and its value contains information
667674
# about them (e.g.: their name, version number)
668675
#
669-
# * doesn't provide any value as far as users are concern,
670-
# and in some cases, the information provided by it can
671-
# be used by attackers
676+
# * doesn't provide any value to users, contributes to header
677+
# bloat, and in some cases, the information it provides can
678+
# expose vulnerabilities
672679
#
673680
# (!) If you can, you should disable the `X-Powered-By` header from the
674681
# language / framework level (e.g.: for PHP, you can do that by setting
@@ -753,17 +760,22 @@ ServerSignature Off
753760
"application/x-web-app-manifest+json" \
754761
"application/xhtml+xml" \
755762
"application/xml" \
763+
"font/collection" \
756764
"font/eot" \
757765
"font/opentype" \
766+
"font/otf" \
767+
"font/ttf" \
758768
"image/bmp" \
759769
"image/svg+xml" \
760770
"image/vnd.microsoft.icon" \
761771
"image/x-icon" \
762772
"text/cache-manifest" \
773+
"text/calendar" \
763774
"text/css" \
764775
"text/html" \
765776
"text/javascript" \
766777
"text/plain" \
778+
"text/markdown" \
767779
"text/vcard" \
768780
"text/vnd.rim.location.xloc" \
769781
"text/vtt" \
@@ -865,6 +877,7 @@ FileETag None
865877
ExpiresByType application/schema+json "access plus 0 seconds"
866878
ExpiresByType application/vnd.geo+json "access plus 0 seconds"
867879
ExpiresByType application/xml "access plus 0 seconds"
880+
ExpiresByType text/calendar "access plus 0 seconds"
868881
ExpiresByType text/xml "access plus 0 seconds"
869882

870883

@@ -892,6 +905,11 @@ FileETag None
892905
ExpiresByType text/cache-manifest "access plus 0 seconds"
893906

894907

908+
# Markdown
909+
910+
ExpiresByType text/markdown "access plus 0 seconds"
911+
912+
895913
# Media files
896914

897915
ExpiresByType audio/ogg "access plus 1 month"
@@ -908,15 +926,20 @@ FileETag None
908926

909927
# Web fonts
910928

929+
# Collection
930+
ExpiresByType font/collection "access plus 1 month"
931+
911932
# Embedded OpenType (EOT)
912933
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
913934
ExpiresByType font/eot "access plus 1 month"
914935

915936
# OpenType
916937
ExpiresByType font/opentype "access plus 1 month"
938+
ExpiresByType font/otf "access plus 1 month"
917939

918940
# TrueType
919941
ExpiresByType application/x-font-ttf "access plus 1 month"
942+
ExpiresByType font/ttf "access plus 1 month"
920943

921944
# Web Open Font Format (WOFF) 1.0
922945
ExpiresByType application/font-woff "access plus 1 month"
@@ -925,6 +948,7 @@ FileETag None
925948

926949
# Web Open Font Format (WOFF) 2.0
927950
ExpiresByType application/font-woff2 "access plus 1 month"
951+
ExpiresByType font/woff2 "access plus 1 month"
928952

929953

930954
# Other
@@ -980,5 +1004,5 @@ FileETag None
9801004
# <IfModule mod_rewrite.c>
9811005
# RewriteEngine On
9821006
# RewriteCond %{REQUEST_FILENAME} !-f
983-
# RewriteRule ^(.+)\.(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ $1.$3 [L]
1007+
# RewriteRule ^(.+)\.(\d+)\.(bmp|css|cur|gif|ico|jpe?g|m?js|png|svgz?|webp|webmanifest)$ $1.$3 [L]
9841008
# </IfModule>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"devDependencies": {
33
"@alrra/travis-scripts": "^3.0.1",
4-
"apache-server-configs": "2.14.0",
4+
"apache-server-configs": "2.15.0",
55
"archiver": "^2.0.0",
66
"babel-core": "^6.25.0",
77
"babel-preset-es2015": "^6.18.0",

0 commit comments

Comments
 (0)