Open
Description
Version
3.7.0
Reproduction link
https://github.com/dy86/vue-cli-issue-demo.git
Environment info
System:
OS: macOS 10.14.4
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
Safari: 12.1
npmGlobalPackages:
@vue/cli: 3.5.5
Steps to reproduce
使用vue-create-app创建好的项目,直接支行npm run serve
我的电脑IP:10.0.1.10
当访问http://localhost:8080/时`sockjs-node`的url为:http://10.0.1.10:8080/sockjs-node/info?t=xxxxxx
当访问http://10.0.1.10:8080/时`sockjs-node`的url为:http://localhost:8080/sockjs-node/info?t=xxxxxx
总是相反的,这样就产生了CORS的错误信息:
Access to XMLHttpRequest at 'http://localhost:8080/sockjs-node/info?t=1557469168759' from origin 'http://10.0.1.10:8080' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
What is expected?
`sockjs-node`的url与访问的url相对应,避免控制台出现CORS报错信息
What is actually happening?
我的电脑IP:10.0.1.10
当访问http://localhost:8080/时`sockjs-node`的url为:http://10.0.1.10:8080/sockjs-node/info?t=xxxxxx
当访问http://10.0.1.10:8080/时`sockjs-node`的url为:http://localhost:8080/sockjs-node/info?t=xxxxxx
总是相反的,这样就产生了CORS的错误信息:
Access to XMLHttpRequest at 'http://localhost:8080/sockjs-node/info?t=1557469168759' from origin 'http://10.0.1.10:8080' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
我不确定这个是不是vue-cli的问题,是不是webpack-dev-server的bug呢?