-1

I have a problem while sending request from jsfiddle to an api that I don't own, it returns an error message error message in console

async function send() {

  const getIp = await axios.get('https://checkip.amazonaws.com/', {
    headers: {
      "Access-Control-Allow-Origin": "*"
    }
  }).then(() => {
    console.log("1234");
  }).catch((err) => console.log(err))

}
send();

so what seems to be the problem? and how can I solve this issue?

I would really appreciate your help.

mmb
  • 1
  • 1
  • 1
    The error message is pretty clear. The access control header is something the **server** has to send in its **response**; it's not a request header. – Pointy Nov 23 '22 at 13:02

1 Answers1

-1

CORS error is an security error that backend returns it to avoid access from other platforms but the main domains if you don't own the api service you can ask owner to give you the access.