@font-face with custom domain


#1

Hi,

I am trying to use a custom font for my customer’s landing page. The page is still work-in-progress and not published.

The customer hosts the font on their server that shares the domain with the rest of their website. @font-face does not work at the moment because the customer does not have enabled “Access-Control-Allow-Origin: *” for understandable reasons (the font is commercial and should not be shared with anybody who requests it).

So my question is this: after we publish the landing page we will create a custom domain. It will have to be a sub-domain of the customer’s website. Will @font-face work when the landing page will have the sub-domain of the domain where the font is hosted (without access-control-allow-origin *)? Or will the landing page still request the font as unbouncepages.com?

Thank you in advance for helping! I hope the question was clear


#2

Hey @Max_Samarin you MUST include “access-control-allow-origin” to access fonts cross domain. Usually web browsers forbid cross-domain requests, due the same origin security policy. That’s why using web-fonts from remote domain may cause an error in your browser.

You should, however, be able to add “Access-Control-Allow-Origin” in the header of your .htaccess file within the sub-domain.


#3

Hi Brendan,

Thank you for your quick answer. Is it however possible to access the font without “Access-Control-Allow-Origin” on the SAME domain (or, from the sub-domain)?


#4

As far as I know, NO!

Any @Unbounce-Experts have other info? :slight_smile:


#5

You shouldn’t have problems with loading fonts on the sub-domain.

Best,
Hristian