Skip to content

Commit a0c4e17

Browse files
committed
Add configs for text/x-cross-domain-policy
Ensure that files marked as `text/x-cross-domain-policy` will: * be served compressed¹ (they are `xml` files, therefore, they compress quite nicely) * be served with future expires headers (by default the cache time is set to one week as most of the time the well-known location `/crossdomain.xml` will be used) Notes: * The configurations for the `text/x-cross-domain-policy` media type. are added mainly due to its high usage³. * The `text/x-cross-domain-policy` media type cannot be accurately² set from a `.htaccess` file, so that part will be left to the user. * Since the policy files will usually have the `.xml` extension, they will not be served with any of the `HTML` document related headers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ¹ http://www.adobe.com/devnet-docs/acrobatetk/tools/AppSec/xdomain.html#policy-file-host-basics https://cloud.githubusercontent.com/assets/1223565/4783742/7458c9b0-5d34-11e4-9ea8-aece6f7ec2cd.png ² https://github.com/h5bp/server-configs-apache/blob/2.10.0/dist/.htaccess#L182-L206 ³ e.g.: According to the results from the HTTP Archive from 15.10.2014: +----+--------------------+---------------------------------+ | | number of requests | media type | +----+--------------------+---------------------------------+ | 1 | 7406888 | image/jpeg | | | ... | ... | * | 21 | 54476 | text/x-cross-domain-policy | | | ... | ... | +----+--------------------+---------------------------------+ Query used: select count(requestid) as number_of_requests, mimetype as media_type from [httparchive:runs.2014_10_15_requests] group by media_type order by number_of_requests desc; https://www.igvita.com/2013/06/20/http-archive-bigquery-web-performance-answers/
1 parent 809b27f commit a0c4e17

File tree

5 files changed

+13
-0
lines changed

5 files changed

+13
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### HEAD
22

3+
* Add configs for files marked as `text/x-cross-domain-policy`.
34
* Add configs for files marked as `image/vnd.microsoft.icon`
45
[[0ba37cb](https://github.com/h5bp/server-configs-apache/commit/0ba37cb77de29b29e44145046a936483aeb1bfc5)].
56
* Add configs for files marked as `font/eot`

dist/.htaccess

+4
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ AddDefaultCharset utf-8
734734
"text/vnd.rim.location.xloc" \
735735
"text/vtt" \
736736
"text/x-component" \
737+
"text/x-cross-domain-policy" \
737738
"text/xml"
738739

739740
</IfModule>
@@ -866,6 +867,9 @@ FileETag None
866867
ExpiresByType font/opentype "access plus 1 month"
867868
ExpiresByType image/svg+xml "access plus 1 month"
868869

870+
# Other
871+
ExpiresByType text/x-cross-domain-policy "access plus 1 week"
872+
869873
</IfModule>
870874

871875
# ----------------------------------------------------------------------

src/web_performance/compression.conf

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"text/vnd.rim.location.xloc" \
5757
"text/vtt" \
5858
"text/x-component" \
59+
"text/x-cross-domain-policy" \
5960
"text/xml"
6061

6162
</IfModule>

src/web_performance/expires_headers.conf

+3
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,7 @@
6767
ExpiresByType font/opentype "access plus 1 month"
6868
ExpiresByType image/svg+xml "access plus 1 month"
6969

70+
# Other
71+
ExpiresByType text/x-cross-domain-policy "access plus 1 week"
72+
7073
</IfModule>

test/fixtures/.htaccess

+4
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ AddDefaultCharset utf-8
686686
"text/vnd.rim.location.xloc" \
687687
"text/vtt" \
688688
"text/x-component" \
689+
"text/x-cross-domain-policy" \
689690
"text/xml"
690691

691692
</IfModule>
@@ -818,6 +819,9 @@ FileETag None
818819
ExpiresByType font/opentype "access plus 1 month"
819820
ExpiresByType image/svg+xml "access plus 1 month"
820821

822+
# Other
823+
ExpiresByType text/x-cross-domain-policy "access plus 1 week"
824+
821825
</IfModule>
822826

823827
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)