Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorry, failed to upload file: No 'Access-Control-Allow-Origin' header #82

Closed
rileycrane opened this issue Nov 23, 2016 · 2 comments
Closed

Comments

@rileycrane
Copy link

rileycrane commented Nov 23, 2016

While developing locally, I continue to run into a pop up Sorry, failed to upload file. The console shows the issue is:

XMLHttpRequest cannot load https://s3-us-west-2.amazonaws.com/BUCKETNAME. 
Response to preflight request doesn't pass access control check: 
No 'Access-Control-Allow-Origin' header is present on the requested resource. 
Origin 'http://localhost:8000' is therefore not allowed access.

Any advice on how to proceed? I've updated the CORS policy in S3 to be

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>DELETE</AllowedMethod>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>
@rileycrane
Copy link
Author

changing region to S3DIRECT_REGION = 'us-east-1' fixed the issue.

@akalinmehmet
Copy link

To prevent misunderstandings for ones facing with this error, S3DIRECT_REGION must be set to your S3 Bucket's region not staticely 'us-east-1'.

For example, my S3 Bucket stays on 'US-WEST-2' so this value is, for me,
S3_DIRECT_REGION = 'us-west-2'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants