XMLHttpRequest cannot load http://localhost:3000/venues. Origin http://localhost:3501 is not allowed by Access-Control-Allow-Origin.
AFAIK,相同的原始政策应该只在跨不同域提出请求时启动.当我们从localhost请求localhost(虽然是不同的端口)时,为什么会抱怨?
我怎样才能完成这项工作,这会导致生产中出现问题吗?
XMLHttpRequest cannot load http://localhost:3000/venues. Origin http://localhost:3501 is not allowed by Access-Control-Allow-Origin.
AFAIK,相同的原始政策应该只在跨不同域提出请求时启动.当我们从localhost请求localhost(虽然是不同的端口)时,为什么会抱怨?
我怎样才能完成这项工作,这会导致生产中出现问题吗?
如果您需要在不同端口上运行这两个应用程序(客户端和后端),请考虑使用http://enable-cors.org/