Question

CORS not recognizing prefixed URL?

Posted July 18, 2021 183 views
Node.jsDigitalOcean App Platform

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.

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.

×
Submit an Answer
1 answer

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