Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Argaw 3 posts 73 karma points
    19 days ago
    Argaw
    0

    CORS Issue with React App and Umbraco Heartcore - Configuration in Umbraco Cloud

    Hi Umbraco Community,

    I'm encountering a CORS issue between my React application and my Umbraco Heartcore project. My React app is running locally during development (e.g., http://localhost:3000), and I'm trying to make API requests to my Heartcore instance. However, I'm receiving CORS errors in my browser console, preventing my React app from fetching data and the same request works from Postman.

    I understand that CORS configuration for Heartcore is managed through the Umbraco Cloud portal, not via appsettings.json or any file access. I've logged into my Umbraco Cloud account, navigated to my Heartcore project's settings, and looked for options related to "Domains," "Hostnames," or "Custom Domains."

    I've added http://localhost:3000 to the allowed domains/origins in the Cloud portal. I've also tried variations like https://localhost:3000 and localhost:3000 just in case, but the issue persists.

    Here are some details about my setup:

    Umbraco Heartcore version: (If you know it, include it) React version: (e.g., React 18) Method of making API requests: (e.g., fetch) Steps I've already taken: (As described above) Could someone please provide guidance on how to correctly configure CORS for my Heartcore project in the Umbraco Cloud portal? Is there anything I might be missing? Any help would be greatly appreciated!

    Thanks in advance,

  • Afreed 86 posts 383 karma points
    18 days ago
    Afreed
    0

    Hi Argaw,

    I haven't worked with Heartcore, If you got a kudu console from the cloud. Try adding custom headers for cors to allow any in the web.config itself.

  • Jordan McFarlane 2 posts 92 karma points hq
    17 days ago
    Jordan McFarlane
    0

    My guess is that the actual root cause is something else, since Heartcore APIs have no configurable CORS policy; they simply allow everything.

    Odds are there's a more specific error being returned from the API. These errors typically don't respond with CORS headers, which is why the browser interprets them that way.

    You'll probably get more info from the response of the failing request in the network tab of your browser tools.

  • Argaw 3 posts 73 karma points
    1 week ago
    Argaw
    0

    I resolve the issue by removing the depth header parameter.

Please Sign in or register to post replies

Write your reply to:

Draft