0

I'm doing a request from my local server and:

  • I'm getting 200 and the data (as far as I can see in the network tab of the developer console)
  • If I make the request with POSTMAN it works fine.
  • I'm not getting the data in my client. Instead of that I'm getting the following object:
{ _40: 0
_55: null
_65: 0
_72: null }

The developer console gives me this feedback:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://theurlthatiwanttoget.herokuapp.com/something. (Reason: CORS request did not succeed).

My request:

await axios.get('https://theurlthatiwanttoget.herokuapp.com/something', {
            headers: {"Access-Control-Allow-Origin": "*"}
});

My question is: Can I do something from the client or I can be sure that the problem is that is not autorized in the server?

Darío GL
  • 64
  • 1
  • 2
  • 8

1 Answers1

0

you can create proxy.conf.json file

containing

{
  "/api": {
    "target": "http://your address/",
    "secure": true,
    "changeOrigin": true
  }
}

and run

serve command with --proxy-config proxy.conf.json

SalunkeAkash
  • 236
  • 1
  • 9