OPTIONS request is being sent instead of GET

73 views Asked by At

I am sending a GET request via text/plain and the OPTIONS request is sent before that. Why is that so?

xmlhttp.open("GET", url, true);
xmlhttp.setRequestHeader("Content-Type", "text/plain");
xmlhttp.setRequestHeader("partner", "root");
xmlhttp.setRequestHeader("token", "token");
xmlhttp.send();

This is how I send it, the request:

Request Method:OPTIONS
Status Code:200 OK

And the error is:

Request header field partner is not allowed by Access-Control-Allow-Headers in preflight response.
0

There are 0 answers