Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at … (Reason: CORS request did not succeed)

bhutakhanUS 6 Reputation points
2021-06-24T10:30:07.897+00:00

I have a backend app, which is running on port 3000 on a remote server. There is another react app served on the same remote server on port 5000. I have exposed port 5000 by ufw allow 5000. When open the frontend app on the browser ip:5000, it can't send request to my backend apis. I get this error -

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3001/v1/login. (Reason: CORS request did not succeed)
How do I solve this?

Windows for business | Windows Client for IT Pros | User experience | Remote desktop services and terminal services
{count} votes

2 answers

Sort by: Most helpful
  1. Leila Kong 3,706 Reputation points
    2021-06-25T02:55:08.207+00:00

    Hello @bhutakhanUS ,

    Thanks for your query.

    If the CORS configuration isn't setup correctly, the browser console will present an error like "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at $somesite" indicating that the request was blocked due to violating the CORS security rules.
    Part of the error text is a "reason" message that provides added insight into what went wrong. The reason messages are listed below; click the message to open an article explaining the error in more detail and offering possible solutions.
    Reason: CORS request did not succeed: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSDidNotSucceed

    In many cases, it is caused by a browser plugin (e.g. an ad blocker or privacy protector) blocking the request.
    Other possible causes include:
    Trying to access an https resource that has an invalid certificate will cause this error.
    Trying to access an http resource from a page with an https origin will also cause this error.
    As of Firefox 68, https pages are not permitted to access http://localhost, although this may be changed by Bug 1488740.
    The server did not respond to the actual request (even if it responded to the Preflight request). One scenario might be an HTTP service being developed that panicked without returning any data.

    CORS errors: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors

    Best regards,
    Leila

    ----------

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Leila Kong 3,706 Reputation points
    2021-07-06T09:46:31.063+00:00

    Hello @bhutakhanUS ,

    We haven’t heard from you in a couple of days.
    How are things going there on this issue?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.