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

Document CORS configuration for direct uploads #32581

Closed
georgeclaghorn opened this issue Apr 15, 2018 · 5 comments
Closed

Document CORS configuration for direct uploads #32581

georgeclaghorn opened this issue Apr 15, 2018 · 5 comments

Comments

@georgeclaghorn
Copy link
Contributor

To use direct uploads with a cloud storage service like S3 or Google Cloud Storage, you must configure the service to accept cross-origin requests from all of your application’s domains. We neglect to mention this in the guides, leaving Active Storage users to stub their toes when direct uploads fail in production.

@lucaong
Copy link
Contributor

lucaong commented Apr 22, 2018

Absolutely, this is very important, as debugging it is not trivial. Particularly, which headers must be allowed. On Google Cloud Storage, these are the headers that I need to allow for direct upload to work properly (the Content-Md5 was a gotcha):

Access-Control-Allow-Headers: Content-Type, Content-Length, Content-Md5

@wbotelhos
Copy link
Contributor

Hi @georgeclaghorn and @lucaong ,

I did not configurate the header to direct upload, but attached a policy to EC2 with Action: s3:*, maybe it solved.

Should I let my bucket public for List objects? Only with that I could make upload and show works.

@rails-bot rails-bot bot added the stale label Aug 16, 2018
@rails-bot
Copy link

rails-bot bot commented Aug 16, 2018

This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 5-2-stable branch or on master, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.

gaurish added a commit to gaurish/rails that referenced this issue Sep 30, 2018
I spent few hours of my sunday figuring this out. Thought, I should write about this, so the next person implemetating direct uploads can save time.
[ci skip] Reviews welcome.
@gaurish
Copy link
Contributor

gaurish commented Sep 30, 2018

fixed via #34028

@connorshea
Copy link
Contributor

This just bit me in production, I would really appreciate documentation on this!

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

No branches or pull requests

7 participants
@georgeclaghorn @wbotelhos @lucaong @gaurish @connorshea and others