Question

Getting 403 error on font files using App Platform with Spaces

Hi,

I have a test project hosted on the App Platform combined with Spaces. All static files hosted there work just fine with one exception: fonts. When I load the page I get the following error in console: net::ERR_ABORTED 403.

My file structure is as follows:

PROJECT
-app
-app
--templates
--static
---static/CSS -> .css file
---static/fonts -> font files

In my css the font files are loaded as follows:

@font-face {
    font-family: 'poppins-bold';
    src: url('/static/fonts/Poppins-SemiBold.woff2') format('woff2');
}

I tried to set **CORS **in my spaces settings with the following origin: https://*.ondigitalocean.app and GET as method.

What am I doing wrong or missing? This works perfectly fine in development, just not in production.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 18, 2023

Hi there,

After setting the allowed origin to https://*.ondigitalocean.app and the allowed Methods GET, did you also add a Allowed Header? If not, you can do so and specify * as the value.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel