Deadly CORS when http://localhost is the origin

后端 未结 9 1456
迷失自我
迷失自我 2020-11-22 00:54

I am stuck with this CORS problem, even though I set the server (nginx/node.js) with the appropriate headers.

I can see in Chrome Network pane -> Response Headers:

9条回答
  •  半阙折子戏
    2020-11-22 01:43

    Chrome does not support localhost for CORS requests (a bug opened in 2010, marked WontFix in 2014).

    To get around this you can use a domain like lvh.me (which points at 127.0.0.1 just like localhost) or start chrome with the --disable-web-security flag (assuming you're just testing).

提交回复
热议问题