Report this

What is the reason for this report?

Configuring access conrol allow origin

Posted on January 27, 2020

Access to font at ‘https://acsess.sgp1.digitaloceanspaces.com/acsess/plugins/fonts/outline-icons.ttf’ from origin ‘http://localhost:8000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

These are one of the files from collectstatic.

This is the error I get on my spaces account.

I am using Django with Boto3 and django-storages.

How can I get these files to work.



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!

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.

Hi @acsfess,

Django by default does not provide the headers necessary to provide cross origin. The easiest way would be to just use this Django app that handles it for you: https://github.com/ottoyiu/django-cors-headers

You can then set whichever domains you want white listed using the settings

CORS_ORIGIN_WHITELIST = (
    'google.com',
    'hostname.example.com'
)

to support allowing all, just use the setting… CORS_ORIGIN_ALLOW_ALL = True and then do any filtering of the request in the middleware or in the view.

Regards, KDSys

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.