djangocorsdjango-admindigital-ocean-spacescross-origin-resource-policy

Django admin Resource Policy COEP ERR_BLOCKED_BY_RESPONSE


The static files of my Django admin site are on a S3 bucket (DigitalOcean Spaces actually) and in the Console I get a ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep 200

In the network panel all the static files are considered 3rd party and blocked for this reason (not same origin)

The response to any one of these files contains a not set cross-origin-resource-policy error which says:

To use this resource from a different origin, the server needs to specify a cross-origin resource policy in the response headers.

What I tried :

What I didn't try:

My workaround:

I don't know where this comes from, a few weeks ago it was all good. Any help appreciated.


Solution

  • With HTTP 2+ it's more efficient to serve assets from the same domain, as they can be served on a single connection.

    Whitenoise is a popular solution for doing so with minimal configuration: ​https://whitenoise.evans.io/en/stable/

    This solved the problem for me.

    Thanks to Adam Johnson from djangoproject.