I am currently trying to implement an image upload feature within the application I’m working on and trying to take advantage of Rails ActiveStorage and DigitalOcean Spaces.
I am generating a presigned-url from ActiveStorage and from that URL I am trying to test an upload with it using Postman.
config/storage.yml file looks like so:
digital_ocean: service: S3 endpoint: https://nyc3.digitaloceanspaces.com access_key_id: XXXX secret_access_key: XXXX region: nyc3 bucket: XXXX public: true
I have updated the
config/environments/development.rb file to use this service
config.active_storage.service = :digital_ocean
Since I am trying to get this to work on development first I have used
s3cmd to configure CORS for my Space.
<CORSConfiguration> <CORSRule> <AllowedOrigin>http://localhost:3000</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>POST</AllowedMethod> <AllowedMethod>PUT</AllowedMethod> <AllowedMethod>DELETE</AllowedMethod> <AllowedMethod>HEAD</AllowedMethod> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration>
Using Postman, I POST to an endpoint within my application to generate a presigned-url which gets returned.
The idea is that the front-end portion of my application would PUT to this URL.
I then try to PUT to it, setting the binary to a file I wish to upload, each time I submit, I get the following 403 Forbidden back:
<?xml version="1.0" encoding="UTF-8"?> <Error> <Code>SignatureDoesNotMatch</Code> <RequestId>tx000000000000032e92095-0060ad32dc-c814494-nyc3c</RequestId> <HostId>c814494-nyc3c-nyc3-zg03</HostId> </Error>
Any and all help would be greatly appreciated
Thanks in advance
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Click below to sign up and get $100 of credit to try our products over 60 days!