Question

CORS not recognizing prefixed URL?

As I am working to connect my react-app with my node back-end, both using DO’s App Platform, I struggle with CORS. As I found out I need t make changes in app settings, done. My app now allows the origin “https://xxxx-front-end-mbxab.ondigitalocean.app”, the URL of my react app.

services:
- cors:
    allow_headers:
    - 'Authorization'
    allow_methods:
    - GET
    - POST
    - PUT
    - DELETE
    allow_origins:
    - prefix: https://xxxx-front-end-mbxab.ondigitalocean.app

However, when making the request via https://xxxx-front-end-mbxab.ondigitalocean.app/app/dashboard I get the following error: “Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://back-end-wju6y.ondigitalocean.app/cats/requests. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).”

Is this normal due to limits or am I making a mistake? Because, I have checked this out, using Postman and two browser-based testers APIs are doing fine. That’s confusing.

Does anybody have an idea or solution for this? Would be great.


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @bluecrunch,

The CORS configuration for your app specification looks correct. To troubleshoot this further could you please raise a support ticket with us and we will get back to you as soon as possible.

Cheers, Taha Fatima