I am hosting a Strapi application on the DO App platform and using a DO spaces to host images for it. I think I have updated the CORS policy for the Spaces bucket but I can’t work out how to add CORS for my actual app.
In Strapi, there is a CORS config which I have setup but not sure if DO adds its own.
A client that uses the app and the website it servers content to has been running into a CORS error - Access to XMLHttpRequest at ‘URL OF API’ from origin ‘WEBSITE’ has been blocked by CORS policy No ‘Access-Control-Allow-Origin’ header is present on the resource.
Any help with these issues would be grand.
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.
Click below to sign up and get $200 of credit to try our products over 60 days!
In addition to configuring the CORS settings in your Spaces, I would recommend two additional things:
config/middleware.jsfile. In the
originfield, you list the domains that you want to allow. The
methodsfield lists the HTTP methods that your server will allow. The
headersfield lists the request headers that your server will allow.
If you are still hitting the error, feel free to share the exact error message that you are seeing in your web console here.