Hosting fonts without getting CORS errors

Username (e[dot]g. epiz_XXX) or Website URL

www[dot]fonts[dot]epizy[dot]com
(please specify the website or account you are asking about)

Error Message

From Browser Console: Access to font at ‘www.fonts.epizy.com/fonts/Open_Sans/OpenSans-Regular.ttf’ from origin ‘user-content.s1.sfmc-content.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
(please share the FULL error message you see)

Other Information

I am trying to host fonts at www[dot]fonts[dot]epizy[dot]com/fonts/Open_Sans/ for other websites. I believed I did everything correctly.

  1. SSL Certificate was installed, hence I can access https site: www[dot]fonts[dot]epizy[dot]com
  2. www[dot]fonts[dot]epizy[dot]com/[dot]htaccess file is installed. If you enter www[dot]fonts[dot]epizy[dot]com/foobar/ in a browser, it will redirect to apple[dot]com:
#CORS CONFIG FOR APACHE
<FilesMatch ".(eot|otf|svg|ttf|woff|woff2)">
    Header always set Access-Control-Allow-Origin "*"
</FilesMatch>

I read from forum[dot]infinityfree[dot]net/t/ensuring-only-web-browsers-can-access-your-website/49353 that there are certain AJAX CORS restrictions and may have an error message: “ * No ‘Access-Control-Allow-Origin’ header is present on the requested resource”

I am not good at website config. Any help would be appreciated.

Jay
(other information and details relevant to your question)

You can’t do that here. You can only host files that you are using for your own website.

You can use a CDN, or a file hosting service (Like GitHub) in order to host files that you want to be accessed from outside your website.

5 Likes

Since it’s a Google Font, I’d suggest just using Google CDN. It’s easier & faster that way.
Hope this helps.

They are not Googe fonts, but from various font foundries, Adobe, myfonts.com, etc.

Thanks for the GitHub reference. I will look further.

Ah I see, I remind you, hosting nulled content is strictly banned. IIRC, you need an Adobe Subscription and pay myfonts.com for the fonts and reselling it is not allowed.

Can’t you just serve the font files used on a particular website from the same domain and hosting as the rest of the website? It’s not like font files are so big and unwieldy you absolutely need separate storage for them.

And if this is not possible because you’re dealing with a hosting environment with limited features, fetching them from public CDN mirrors is more reliable than whatever you can cobble together yourself using freebies.

5 Likes