Why is same origin policy kicking in when making request from localhost to localhost?

前端 未结 2 941
不思量自难忘°
不思量自难忘° 2020-12-11 05:32

I\'m keeping the backend API as a separate project from the frontend HTML5 app consuming it. I\'m using Yeoman for the frontend development. Yeoman runs on localhost:3501 an

2条回答
  •  自闭症患者
    2020-12-11 05:56

    The ports also count for cross domain requests, therefore http://localhost:3000 and http://localhost:3501 are 2 different domains (from browser's point of view).

    If you need both applications (client and backend) to run on different ports, consider using http://enable-cors.org/

提交回复
热议问题