Rails ActiveStorageDigitalOcean Spaces CORS
I’m getting a CORS error when trying to upload an image to DigitalOcean Spaces, despite it working fine in development and test.
The error is as follows:
Access to XMLHttpRequest at 'https://vglist.sfo2.digitaloceanspaces.com/KaRtoiMSiLxFpJGQHg8ZrXrC' from origin 'https://vglist.co' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
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.