Request doesn't pass access control check: No 'Access-Control-Allow-Origin'

前端 未结 2 1359
遥遥无期
遥遥无期 2021-01-22 01:23

I am just trying to use mocky.io from my http://localhost:8080

But getting this error:

XMLHttpRequest cannot load http:/

2条回答
  •  面向向阳花
    2021-01-22 01:35

    Actually you should setup the header Access-Control-Allow-Origin in mocky.io. Just click on "Switch to Advanced mode" and you will see a "custom headers" input. Add Access-Control-Allow-Origin and put * as its value. Then create your mocky.io url. It should work now.

提交回复
热议问题