0

I am making a RestApi call from localhost and i got the below error

XMLHttpRequest cannot load https://api-address/v1/registeruser.
No 'Access-Control-Allow-Origin' header is present on the
requested resource.Origin 'http://127.0.0.1:8887' is therefore not allowed  access. 
The response had HTTP status code 502.

then i tried fixing this and added CORS extention to chrome which i got from SO. after adding the extention I again got the below error

POST https://api-address/v1/registeruser 502 (Proxy Error)

how to fix this issue?

aries12
  • 370
  • 2
  • 18

1 Answers1

0

If you are using Chrome this may be related to the fact that it is preflighting ajax requests by sending OPTIONS before GET/POST/PUT/DELETE as discussed here:

AJAX in Chrome sending OPTIONS instead of GET/POST/PUT/DELETE?

I suggest making sure that your REST server is capable of responding to OPTIONS request.

Community
  • 1
  • 1
Yurii Dolhikh
  • 1,361
  • 1
  • 11
  • 13