Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Cross-Origin Request Blocked using AWS for static files
Post Flair (click to view more posts with a particular flair)
Post Body

I set up a Django website using nginx and gunicorn. Everything is loding fine except for a static file because of

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://XXXXX.s3.amazonaws.com/js/cookielaw/jquery.cookie.js. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

I did add the Access-Control-Allow-Origin in Nginx:

location / {
add_header "Access-Control-Allow-Origin" *
....

I also used django-cors-headers with CORS_ALLOW_ALL_ORIGINS = True

The header for the page has the correct header in my browser (Firefox) but when checking the request for the static file, it doesn't:

HTTP/1.1 200 OK
Date: Fri, 27 Aug 2021 13:34:26 GMT
Last-Modified: Thu, 26 Aug 2021 14:43:02 GMT
Cache-Control: max-age=86400
Accept-Ranges: bytes
Content-Type: application/javascript
Server: AmazonS3
Content-Length: 3139

So it gets blocked by the browser I guess. Anyone know how I can fix this?

Edit: Forgot to mention django-core-headers

Author
Account Strength
100%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
5,458
Link Karma
1,171
Comment Karma
4,206
Profile updated: 1 day ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago