Question

CORS Issue When Accessing Files from Digital Ocean Spaces in React-Adonis App

I deployed my React.js + Adonis.js app to Digital Ocean Spaces, but I’m running into a CORS error when trying to access files from my app.

  • If I copy the file URL and paste it into a new browser tab, the file loads successfully.

  • However, when trying to fetch it from my app, I get a CORS error in the console.

  • The same code worked perfectly on AWS S3 without any CORS issues. Here’s an example of the error: Access to fetch at ‘<DigitalOcean_Spaces_URL>/file_directory/<file>.pdf’ from origin ‘<my_app_URL>’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

  • I have followed Digital Ocean’s documentation on setting CORS permissions, but the issue persists.

Has anyone encountered this before? Any ideas on how to resolve it?


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
March 12, 2025

Hey there 👋

Even though the files load fine when accessed directly in the browser, browsers will block JavaScript-based requests (like fetch() or axios) unless CORS is properly configured.

Head over to your Space → Settings → CORS Configurations and make sure you’ve added your domain correctly there?

Don’t forget to include the full URL with https:// if you’re using SSL, it’s required for the CORS rule to work properly.

If you can, feel free to share a screenshot of your current CORS config, happy to take a look and help you troubleshoot!

- Bobby

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.