Report this

What is the reason for this report?

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

Posted on March 10, 2025

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?



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!

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.

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

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.