Use correct content-type for WOFF fonts #405

Closed
wants to merge 1 commit into
from

Projects

None yet

9 participants

@benschwarz

The incorrect content type is being used for WOFF fonts.
This causes issues in Firefox.

As an asides, for those who find this issue, and want their application to use the correct headers NOW:

Add this to your config.ru.

Rack::Mime::MIME_TYPES['.woff'] = 'application/font-woff'

@travisbot

This pull request fails (merged bc1bae4 into edc8b92).

@kyledrake

+1, I've run into this problem before.

@benschwarz

Any movement here? This build failed due to another issue in Rack. Not this patch.

@raggi
Official Rack repositories member

This isn't in IANA yet, what standards body defined this? Is it defined?

@gioele

The W3C WOFF spec is in candidate recommendation status since 2011-08.

From http://www.w3.org/TR/WOFF/#appendix-b:

Type name: application

Subtype name: font-woff

Chromium seems to prefer application/x-font-woff: http://code.google.com/p/chromium/issues/detail?id=70283#c3.

@benschwarz
@raggi
Official Rack repositories member

Well hang on, before you both pretend to agree there, contradictory values were provided.

This is what standards bodies are for. I am quite strongly against the fact that it's now taken over 18 months to standardize a one-line entry in a standards list.

@benschwarz

Chrome will render woff even if you use a application/octect-steam mime.
Firefox requires application/font-woff.

This patch isn't going to break anything or misrepresent a grossly incorrect… it works in all woff supporting browsers.

@gioele

@benschwarz are you sure that Firefox requires the MIME type? If so then their documentation is out-of-date:

https://developer.mozilla.org/en-US/docs/CSS/@font-face

Note: Because there are no defined MIME types for TrueType, OpenType, and Web Open File Format (WOFF) fonts, the MIME type of the file specified is not considered.

@benschwarz
@raggi
Official Rack repositories member

I'll breach spec, but only if I can get a well built support table first. I know this sounds OCD, but you need to understand that this kind of change ends up being a flip-flop of PRs back and forward unless I can clearly justify the choices we made. This has happened in various other areas of the Rack code base.

@johan

Either of the two suggestions offered are improvement over the current application/octet-stream, which is just wrong and raises warnings in both Firefox and Chrome.

Both Firefox and Chrome silently accept application/x-font-woff today, and until IANA commits to application/font-woff that is anally the correct-by-IETF-procedure thing to use.

The day IANA blesses application/font-woff, we can update again.

@raggi
Official Rack repositories member

The following site is serving up .woffs with application/octet-stream and is not warning in Chrome, I'll check Firefox shortly:

http://people.mozilla.org/~jdaggett/webfonts/gentium-test.html

Update:

Chrome, Firefox and Safari all working at the above example. Correction on the mime type - they're actually not serving one up. Chrome dev tools claims it's application/octet-stream, but that's not actually in the headers. None of the browsers complain with this approach.

@raggi
Official Rack repositories member

This is working without warnings in the current versions of Safari, Chrome and Firefox, rendering correctly, served up with application/octet-stream. Closing out for now, I'd consider x-font-woff instead, but I'm interested to know if this is still a common problem?

@raggi raggi closed this Nov 3, 2012
@benschwarz

At the time of writing four months ago, yes, it was a problem with current releases of Firefox (and prior, non self-updating versions of Firefox).

@eagleflo eagleflo referenced this pull request in ring-clojure/ring Dec 8, 2012
Merged

Added web font MIME types #32

@gioele

For the records, application/font-woff is a registered MIME type since 13th of December. I do not know the current level of support in the browsers.

See http://www.w3.org/TR/WOFF/#appendix-b.

@raggi
Official Rack repositories member

Good news everyone!

I'll re-open to remind myself, and get this closed up when i get to the next round. Thanks @gioele

@raggi raggi reopened this Dec 19, 2012
@raggi raggi added a commit that closed this pull request Dec 29, 2012
@raggi raggi .woff now has an official mime type!
 * Closes #405
ca0da1f
@raggi raggi closed this in ca0da1f Dec 29, 2012
@benschwarz

This has to be the most frustrating PR that I've ever been involved with.

I'm still not sure why you didn't accept my consultation of the issue, nor why you chose to make your own commit, but if this is how other PR's go down, I wouldn't accept further submissions from the community.

@raggi
Official Rack repositories member
@benschwarz

I launched a patch 6 months ago, raggi, you ignored it.
Then when you finally got around to amending it you made your own commit and closed this without a thanks for efforts or anything.

Yeah. Whatever.

@raggi
Official Rack repositories member
  • When you opened the PR, the PR was non-standard, and not 100% compatible with clients. To merge it then would have broken some clients and been non-standard. I deemed this unwise for the time being. I did not reject the PR, as I hoped that the proposal would be accepted.
  • I normally merge PRs, for some reason I had it in my head that this PR contained one of the proposal entries, so when I was doing triage today (I've been doing Rack triage for two days so far this holiday, the first holiday I've had in a year), I made this what, 15 byte? change by hand because it was just as quick as checking out the changeset given the shitty internet connection i was attached to, and the hefty Github pages.
  • I frequently take the time to come into PRs that I've closed up and thank people. Dig through the issues, and you'll see that. I missed yours, and for that I'm really sorry.

You're blowing this out of proportion, and making me feel like a total asshole. This is a 15 byte change, that was standardized less than a month ago. If you really believe I deserve abuse, then feel free to continue.

@benschwarz

Ok, to be perfectly accurate:

  • The PR may not have been a spec when raised, however, it was at W3C draft.
  • At the time of PR, browser vendors had implemented it according to the aforementioned spec.
  • It allowed woff fonts to render in Firefox, not break any other browsers. (Unless I'm mistaken or misguided)
  • You made a call to not merge this patch at the time, that was your call to make. I have no issues with this.

Thanks for clearing up the circumstances of your commit & this PR.

@rkh
Official Rack repositories member
  • popcorn
@yeban

@raggi wrote:

(I've been doing Rack triage for two days so far this holiday, the first holiday I've had in a year)

Programmers take vacations to program 1. Chill @raggi. Number of open issues down to 11, from 35, in 2 days. You rock \m/.

@chneukirchen
Official Rack repositories member

... and please note that even a simple "thanks" comment here sends a mail with zero content to probably a dozen people already. So please consider this next time when posting or trolling on a PR.

@raggi raggi added a commit that referenced this pull request Jan 4, 2013
@raggi raggi .woff now has an official mime type!
 * Closes #405
6835114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment