Skip to content

Commit

Permalink
Add configs for text/x-cross-domain-policy
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
alrra committed Oct 26, 2014
1 parent 809b27f commit a0c4e17
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### HEAD

* Add configs for files marked as `text/x-cross-domain-policy`.
* Add configs for files marked as `image/vnd.microsoft.icon`
[[0ba37cb](https://github.com/h5bp/server-configs-apache/commit/0ba37cb77de29b29e44145046a936483aeb1bfc5)].
* Add configs for files marked as `font/eot`
Expand Down
4 changes: 4 additions & 0 deletions dist/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ AddDefaultCharset utf-8
"text/vnd.rim.location.xloc" \
"text/vtt" \
"text/x-component" \
"text/x-cross-domain-policy" \
"text/xml"

</IfModule>
Expand Down Expand Up @@ -866,6 +867,9 @@ FileETag None
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"

# Other
ExpiresByType text/x-cross-domain-policy "access plus 1 week"

</IfModule>

# ----------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/web_performance/compression.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"text/vnd.rim.location.xloc" \
"text/vtt" \
"text/x-component" \
"text/x-cross-domain-policy" \
"text/xml"

</IfModule>
Expand Down
3 changes: 3 additions & 0 deletions src/web_performance/expires_headers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"

# Other
ExpiresByType text/x-cross-domain-policy "access plus 1 week"

</IfModule>
4 changes: 4 additions & 0 deletions test/fixtures/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ AddDefaultCharset utf-8
"text/vnd.rim.location.xloc" \
"text/vtt" \
"text/x-component" \
"text/x-cross-domain-policy" \
"text/xml"

</IfModule>
Expand Down Expand Up @@ -818,6 +819,9 @@ FileETag None
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"

# Other
ExpiresByType text/x-cross-domain-policy "access plus 1 week"

</IfModule>

# ----------------------------------------------------------------------
Expand Down

0 comments on commit a0c4e17

Please sign in to comment.