1
- # Apache Server Configs v2.14 .0 | MIT License
1
+ # Apache Server Configs v2.15 .0 | MIT License
2
2
# https://github.com/h5bp/server-configs-apache
3
3
4
4
# (!) Using `.htaccess` files slows down Apache, therefore, if you have
5
5
# access to the main server configuration file (which is usually called
6
6
# `httpd.conf`), you should add this logic there.
7
7
#
8
- # https://httpd.apache.org/docs/current/howto/htaccess.html.
8
+ # https://httpd.apache.org/docs/current/howto/htaccess.html
9
9
10
10
# ######################################################################
11
11
# # CROSS-ORIGIN #
18
18
# Allow cross-origin requests.
19
19
#
20
20
# 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/
23
23
24
24
# <IfModule mod_headers.c>
25
25
# Header set Access-Control-Allow-Origin "*"
66
66
# some of the attributes of the `PerformanceResourceTiming` object will
67
67
# be set to zero.
68
68
#
69
- # http ://www.w3.org/TR/resource-timing/
69
+ # https ://www.w3.org/TR/resource-timing/
70
70
# http://www.stevesouders.com/blog/2014/08/21/resource-timing-practical-tips/
71
71
72
72
# <IfModule mod_headers.c>
@@ -120,7 +120,7 @@ Options -MultiViews
120
120
# consider enabling `Enterprise Mode` throughout your company.
121
121
#
122
122
# 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/
124
124
125
125
<IfModule mod_headers.c >
126
126
@@ -130,7 +130,7 @@ Options -MultiViews
130
130
# the `X-UA-Compatible` response header should be send only for
131
131
# HTML documents and not for the other resources.
132
132
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)$" >
134
134
Header unset X-UA-Compatible
135
135
</FilesMatch >
136
136
@@ -143,7 +143,7 @@ Options -MultiViews
143
143
# Allow cookies to be set from iframes in Internet Explorer.
144
144
#
145
145
# 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/
147
147
148
148
# <IfModule mod_headers.c>
149
149
# 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
180
180
# Normalize to standard type.
181
181
# https://tools.ietf.org/html/rfc4329#section-7.2
182
182
183
- AddType application/javascript js
183
+ AddType application/javascript js mjs
184
184
185
185
186
186
# Manifest files
@@ -203,28 +203,20 @@ Options -MultiViews
203
203
AddType video/x-flv flv
204
204
205
205
# 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:
207
207
# https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee
208
208
209
209
AddType image/x-icon cur ico
210
210
211
211
212
212
# Web fonts
213
213
214
- AddType application/ font- woff woff
215
- AddType application/ font- woff2 woff2
214
+ AddType font/ woff woff
215
+ AddType font/ woff2 woff2
216
216
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
228
220
229
221
230
222
# Other
@@ -234,6 +226,8 @@ Options -MultiViews
234
226
AddType application/x-chrome-extension crx
235
227
AddType application/x-opera-extension oex
236
228
AddType application/x-xpinstall xpi
229
+ AddType text/calendar ics
230
+ AddType text/markdown markdown md
237
231
AddType text/vcard vcard vcf
238
232
AddType text/vnd.rim.location.xloc xloc
239
233
AddType text/vtt vtt
@@ -264,10 +258,14 @@ AddDefaultCharset utf-8
264
258
.bbaw \
265
259
.css \
266
260
.geojson \
261
+ .ics \
267
262
.js \
268
263
.json \
269
264
.jsonld \
270
265
.manifest \
266
+ .markdown \
267
+ .md \
268
+ .mjs \
271
269
.rdf \
272
270
.rss \
273
271
.topojson \
@@ -352,7 +350,7 @@ AddDefaultCharset utf-8
352
350
# <IfModule mod_rewrite.c>
353
351
# RewriteEngine On
354
352
# RewriteCond %{HTTPS} !=on
355
- # RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
353
+ # RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
356
354
# </IfModule>
357
355
358
356
# ----------------------------------------------------------------------
@@ -366,20 +364,28 @@ AddDefaultCharset utf-8
366
364
# one.
367
365
#
368
366
# 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
370
368
#
371
369
# If you would prefer to use `Option 2`, just comment out all the
372
370
# lines from `Option 1` and uncomment the ones from `Option 2`.
373
371
#
374
372
# (!) NEVER USE BOTH RULES AT THE SAME TIME!
375
373
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
+
376
381
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
377
382
378
383
# Option 1: rewrite www.example.com → example.com
379
384
380
385
<IfModule mod_rewrite.c >
381
386
RewriteEngine On
382
- RewriteCond %{HTTPS} !=on
387
+ # (1)
388
+ # RewriteCond %{HTTPS} !=on
383
389
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
384
390
RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301 ,L]
385
391
</IfModule >
@@ -393,7 +399,8 @@ AddDefaultCharset utf-8
393
399
394
400
# <IfModule mod_rewrite.c>
395
401
# RewriteEngine On
396
- # RewriteCond %{HTTPS} !=on
402
+ # # (1)
403
+ # # RewriteCond %{HTTPS} !=on
397
404
# RewriteCond %{HTTP_HOST} !^www\. [NC]
398
405
# RewriteCond %{SERVER_ADDR} !=127.0.0.1
399
406
# RewriteCond %{SERVER_ADDR} !=::1
@@ -436,7 +443,7 @@ AddDefaultCharset utf-8
436
443
# https://cure53.de/xfo-clickjacking.pdf.
437
444
#
438
445
# 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/
440
447
# https://www.owasp.org/index.php/Clickjacking
441
448
442
449
# <IfModule mod_headers.c>
@@ -447,7 +454,7 @@ AddDefaultCharset utf-8
447
454
# # the `X-Frame-Options` response header should be send only for
448
455
# # HTML documents and not for the other resources.
449
456
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)$">
451
458
# Header unset X-Frame-Options
452
459
# </FilesMatch>
453
460
@@ -470,9 +477,9 @@ AddDefaultCharset utf-8
470
477
# To make things easier, you can use an online CSP header generator
471
478
# such as: http://cspisawesome.com/.
472
479
#
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/
476
483
477
484
# <IfModule mod_headers.c>
478
485
@@ -482,7 +489,7 @@ AddDefaultCharset utf-8
482
489
# # the `Content-Security-Policy` response header should be send
483
490
# # only for HTML documents and not for the other resources.
484
491
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)$">
486
493
# Header unset Content-Security-Policy
487
494
# </FilesMatch>
488
495
@@ -535,15 +542,15 @@ AddDefaultCharset utf-8
535
542
# left by some text editors and can pose a security risk when anyone
536
543
# has access to them.
537
544
#
538
- # http ://feross.org/cmsploit/
545
+ # https ://feross.org/cmsploit/
539
546
#
540
547
# (!) Update the `<FilesMatch>` regular expression from below to
541
548
# include any files that might end up on your production server and
542
549
# can expose sensitive information about your website. These files may
543
550
# include: configuration files, files that contain metadata about the
544
551
# project (e.g.: project dependencies), build scripts, etc..
545
552
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])|~)$" >
547
554
548
555
# Apache < 2.3
549
556
<IfModule !mod_authz_core.c >
@@ -577,9 +584,9 @@ AddDefaultCharset utf-8
577
584
# (!) Remove the `includeSubDomains` optional directive if the website's
578
585
# subdomains are not using HTTPS.
579
586
#
580
- # http ://www.html5rocks.com/en/tutorials/security/transport-layer-security/
587
+ # https ://www.html5rocks.com/en/tutorials/security/transport-layer-security/
581
588
# 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/
583
590
584
591
# <IfModule mod_headers.c>
585
592
# Header always set Strict-Transport-Security "max-age=16070400; includeSubDomains"
@@ -596,8 +603,8 @@ AddDefaultCharset utf-8
596
603
# is serving user-uploaded content or content that could potentially be
597
604
# treated as executable by the browser.
598
605
#
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/
601
608
# https://msdn.microsoft.com/en-us/library/ie/gg622941.aspx
602
609
# https://mimesniff.spec.whatwg.org/
603
610
@@ -637,8 +644,8 @@ AddDefaultCharset utf-8
637
644
# you are taking all possible measures to prevent XSS attacks, the
638
645
# most obvious being: validating and sanitizing your website's inputs.
639
646
#
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/
642
649
# https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29
643
650
644
651
# <IfModule mod_headers.c>
@@ -650,7 +657,7 @@ AddDefaultCharset utf-8
650
657
# # the `X-XSS-Protection` response header should be send only for
651
658
# # HTML documents and not for the other resources.
652
659
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)$">
654
661
# Header unset X-XSS-Protection
655
662
# </FilesMatch>
656
663
@@ -666,9 +673,9 @@ AddDefaultCharset utf-8
666
673
# (e.g.: ASP.NET, PHP), and its value contains information
667
674
# about them (e.g.: their name, version number)
668
675
#
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
672
679
#
673
680
# (!) If you can, you should disable the `X-Powered-By` header from the
674
681
# language / framework level (e.g.: for PHP, you can do that by setting
@@ -753,17 +760,22 @@ ServerSignature Off
753
760
"application/x-web-app-manifest+json" \
754
761
"application/xhtml+xml" \
755
762
"application/xml" \
763
+ "font/collection" \
756
764
"font/eot" \
757
765
"font/opentype" \
766
+ "font/otf" \
767
+ "font/ttf" \
758
768
"image/bmp" \
759
769
"image/svg+xml" \
760
770
"image/vnd.microsoft.icon" \
761
771
"image/x-icon" \
762
772
"text/cache-manifest" \
773
+ "text/calendar" \
763
774
"text/css" \
764
775
"text/html" \
765
776
"text/javascript" \
766
777
"text/plain" \
778
+ "text/markdown" \
767
779
"text/vcard" \
768
780
"text/vnd.rim.location.xloc" \
769
781
"text/vtt" \
@@ -865,6 +877,7 @@ FileETag None
865
877
ExpiresByType application/schema+json "access plus 0 seconds"
866
878
ExpiresByType application/vnd.geo+json "access plus 0 seconds"
867
879
ExpiresByType application/xml "access plus 0 seconds"
880
+ ExpiresByType text/calendar "access plus 0 seconds"
868
881
ExpiresByType text/xml "access plus 0 seconds"
869
882
870
883
@@ -892,6 +905,11 @@ FileETag None
892
905
ExpiresByType text/cache-manifest "access plus 0 seconds"
893
906
894
907
908
+ # Markdown
909
+
910
+ ExpiresByType text/markdown "access plus 0 seconds"
911
+
912
+
895
913
# Media files
896
914
897
915
ExpiresByType audio/ogg "access plus 1 month"
@@ -908,15 +926,20 @@ FileETag None
908
926
909
927
# Web fonts
910
928
929
+ # Collection
930
+ ExpiresByType font/collection "access plus 1 month"
931
+
911
932
# Embedded OpenType (EOT)
912
933
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
913
934
ExpiresByType font/eot "access plus 1 month"
914
935
915
936
# OpenType
916
937
ExpiresByType font/opentype "access plus 1 month"
938
+ ExpiresByType font/otf "access plus 1 month"
917
939
918
940
# TrueType
919
941
ExpiresByType application/x-font-ttf "access plus 1 month"
942
+ ExpiresByType font/ttf "access plus 1 month"
920
943
921
944
# Web Open Font Format (WOFF) 1.0
922
945
ExpiresByType application/font-woff "access plus 1 month"
@@ -925,6 +948,7 @@ FileETag None
925
948
926
949
# Web Open Font Format (WOFF) 2.0
927
950
ExpiresByType application/font-woff2 "access plus 1 month"
951
+ ExpiresByType font/woff2 "access plus 1 month"
928
952
929
953
930
954
# Other
@@ -980,5 +1004,5 @@ FileETag None
980
1004
# <IfModule mod_rewrite.c>
981
1005
# RewriteEngine On
982
1006
# 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]
984
1008
# </IfModule>
0 commit comments