SpringAll icon indicating copy to clipboard operation
SpringAll copied to clipboard

Firefox has a cross-domain restriction for @font-face

Open arlogn opened this issue 14 years ago • 23 comments

Seems that Firefox require access control headers for cross-domain fonts. There is a problem with new Roboto font. ff_roboto_lmde

arlogn avatar Jun 15 '12 18:06 arlogn

shouldn't be... I know you can embed fonts from google web fonts, and those certainly aren't on the same server :)

Raven24 avatar Jun 15 '12 18:06 Raven24

Google Fonts are served with Access-Control-Allow-Origin:* https://developers.google.com/webfonts/docs/troubleshooting

arlogn avatar Jun 15 '12 20:06 arlogn

Oh, sorry... I was just skimming your comment before. ;) It seems that the problem lies with the asset host of your pod. I don't think Diaspora can do much about that...

Raven24 avatar Jun 15 '12 23:06 Raven24

Yeah, well, this seems to be about the joindiaspora.com pod, so maybe this is the right place for reporting and fixing this ;-)

I'm getting the exact same two error messages with Firefox 12 when loading https://joindiaspora.com/users/sign_in

The problem seems to be that joindiaspora.com is serving most of their assets via cloudfront CND, on a different domain.

A quick check on two other pods, that don't use a CDN: https://diasp.de/users/sign_in and https://pod.geraspora.de/users/sign_in don't provoke this error. And you can even see on the background writing that the font is different from joindiaspora.com

pixelistik avatar Jun 16 '12 11:06 pixelistik

This article nails the problem down:

There are solid services for webfonts, but if you want to serve your own off CloudFront, there's a big problem. FireFox and IE9+ implement HTTP access control, designed to restrict the type of content which can be successfully hotlinked off of other sites. [...] The way to authorize cross-domain font access is via the HTTP Header Access-Control-Allow-Origin, which can be set to a domain or to * to match all domains. The big snag for serving webfonts off of CloudFront is that S3 and CloudFront do not support this header.

There's also a workaround mentioned, sounds rather complicated, though,

pixelistik avatar Jun 16 '12 11:06 pixelistik

Another workaround is to encode the font in base64 and use the @import rule to include it. (or embed it directly).

arlogn avatar Jun 16 '12 23:06 arlogn

Fixed in login page. The problem persists in reactions pane. I suggest to set the color in the class .author-name and inherited value for the font-family. reactions_pane_ff

arlogn avatar Jun 20 '12 11:06 arlogn

Is it possible this bug could crash firefox? That's what happen using-

Puppy Linux - Slacko-5.3.3.1 Firefox 12 (Nightly)

Simply going to https://joindiaspora.com/posts/2466267 crashed the browser and X to terminal prompt.

jonpatterns avatar Mar 22 '13 19:03 jonpatterns

https://diasp.de/posts/667229 also crashed so opened new issue

jonpatterns avatar Mar 22 '13 19:03 jonpatterns

Is this still an issue? Roboto fonts are included in the diaspora installation now, so I imagine this problem no longer happens. Can anyone reproduce it?

goobertron avatar Aug 29 '13 22:08 goobertron

Still have the problem on the 404 until the PR https://github.com/diaspora/diaspora/pull/4079 becomes merged.

Flaburgan avatar Aug 29 '13 22:08 Flaburgan

Now is ok, but the font has a size too big. Some pod can not use their name. roboto_font

arlogn avatar Aug 31 '13 20:08 arlogn

Why can't the font be hosted on the same domain as a site itself?

shmerl avatar Oct 08 '13 15:10 shmerl

@shmerl at least for the 404 page, it's done now. Can you check how the font are loaded for the registration and the connection page?

Flaburgan avatar Oct 08 '13 19:10 Flaburgan

Hosting bug data on dropbox is bad idea - I can't see any screenshots now (github allows attaching images, so folks please use that). I don't see any issue on the 404 page as of now. I see one in the single post view, I commented with details in bug #4453.

shmerl avatar Oct 08 '13 19:10 shmerl

@shmerl I fixed the issue in the 404 page, font are now in the public folder, no problem anymore here.

Flaburgan avatar Oct 08 '13 19:10 Flaburgan

@arlogn did you check that no other pages had the problem? I personally fixed only 404..

Flaburgan avatar Nov 09 '13 20:11 Flaburgan

Joindiaspora still has this problem in many places, so this bug shouldn't be closed yet.

shmerl avatar Nov 10 '13 00:11 shmerl

Ok, reopen. @Flaburgan my only doubt is here: \app\assets\stylesheets\error_pages.css.scss where is Roboto-BoldCondensed?

arlogn avatar Nov 10 '13 00:11 arlogn

well, this file will be removed by my PR https://github.com/diaspora/diaspora/pull/4539 using 404.css instead.

Flaburgan avatar Nov 10 '13 02:11 Flaburgan