Skip to content

Commit

Permalink
Add configs for files marked as font/eot
Browse files Browse the repository at this point in the history
By default the configurations from this repository ensure that
`.eot` files are served with the `application/vnd.ms-fontobject`
media type, compressed, and with far future expires headers.
However, not all users use all the configurations provided by
this project, or in some cases, the headers are overwritten from
the level "beneath" Apache (e.g.: from `php`).

Looking at the results from the HTTP Archive¹ from 15.10.2014:

  +----+--------------------+---------------------------------+
  |    | number of requests |        media type               |
  +----+--------------------+---------------------------------+
  | 1  |            7406888 | image/jpeg                      |
  |    |                ... |                             ... |
* | 10 |             683558 | font/eot                        |
  |    |                ... |                             ... |
* | 17 |             176674 | application/vnd.ms-fontobject   |
  |    |                ... |                             ... |
  +----+--------------------+---------------------------------+

it's clear that the `font/eot` media type is used way more often
than the IANA registered² `application/vnd.ms-fontobject`.

Other incorrect/unofficial media types are also used, but their
usage is either wrong or low enough to not justify their addition.

  +----+--------------------+---------------------------------+
  |    | number of requests |        media type               |
  +----+--------------------+---------------------------------+
  | 1  |             683558 | font/eot                        |
  | 2  |             176674 | application/vnd.ms-fontobject   |
  |    |                ... |                             ... |
  | 6  |               9950 | text/html                       |
  | 7  |               1062 | x-font/eot                      |
  |    |                ... |                             ... |
  | 10 |                400 | application/vnd.bw-fontobject   |
  |    |                ... |                             ... |
  | 15 |                 86 | application/x-font-eot          |
  |    |                ... |                             ... |
  | 17 |                 44 | application/font-eot            |
  |    |                ... |                             ... |
  +----+--------------------+---------------------------------+

Because of the things stated above, the changes from this
commit will ensure that Apache will serve anything labeled with
the `font/eot` compressed and with far future expires headers.

- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - -

¹ https://www.igvita.com/2013/06/20/http-archive-bigquery-web-performance-answers/

  Query used for the first table:

    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;

  Query used for the second table:

    select count(requestid) as number_of_requests,
           mimetype as media_type
    from [httparchive:runs.2014_10_15_requests]
    where (lower(mimetype) contains "eot") or
          (lower(mimetype) contains "vnd.ms-fontobject") or
          (
             regexp_match(lower(url), r'\.eot$') or
             regexp_match(lower(url), r'.eot\?')
          )
    group by media_type
    order by number_of_requests desc;

² http://www.iana.org/assignments/media-types/application/vnd.ms-fontobject
  • Loading branch information
alrra committed Oct 26, 2014
1 parent 1e1bc1e commit 6dae5d4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
### HEAD

* Add configs for files marked as `font/eot`.

### 2.10.0 (October 20, 2014)

* Add `bower.json` and publish on `Bower`
Expand Down
3 changes: 3 additions & 0 deletions dist/.htaccess
Expand Up @@ -703,6 +703,7 @@ AddDefaultCharset utf-8
"application/x-web-app-manifest+json" \
"application/xhtml+xml" \
"application/xml" \
"font/eot" \
"font/opentype" \
"image/bmp" \
"image/svg+xml" \
Expand All @@ -717,6 +718,7 @@ AddDefaultCharset utf-8
"text/vtt" \
"text/x-component" \
"text/xml"

</IfModule>

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -842,6 +844,7 @@ FileETag None
ExpiresByType application/font-woff2 "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/eot "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"

Expand Down
2 changes: 2 additions & 0 deletions src/web_performance/compression.conf
Expand Up @@ -41,6 +41,7 @@
"application/x-web-app-manifest+json" \
"application/xhtml+xml" \
"application/xml" \
"font/eot" \
"font/opentype" \
"image/bmp" \
"image/svg+xml" \
Expand All @@ -55,6 +56,7 @@
"text/vtt" \
"text/x-component" \
"text/xml"

</IfModule>

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down
1 change: 1 addition & 0 deletions src/web_performance/expires_headers.conf
Expand Up @@ -62,6 +62,7 @@
ExpiresByType application/font-woff2 "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/eot "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"

Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/.htaccess
Expand Up @@ -655,6 +655,7 @@ AddDefaultCharset utf-8
"application/x-web-app-manifest+json" \
"application/xhtml+xml" \
"application/xml" \
"font/eot" \
"font/opentype" \
"image/bmp" \
"image/svg+xml" \
Expand All @@ -669,6 +670,7 @@ AddDefaultCharset utf-8
"text/vtt" \
"text/x-component" \
"text/xml"

</IfModule>

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -794,6 +796,7 @@ FileETag None
ExpiresByType application/font-woff2 "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/eot "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"

Expand Down

0 comments on commit 6dae5d4

Please sign in to comment.