-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
请问如何实现代理解决跨域问题,然后怎么开启websocket #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@EvanHunt I'm pretty sure issue belongs here: https://github.com/vuejs-templates/webpack Anyways, to configure proxy middleware you can change WebSocket options for http-proxy-middleware are defined here: https://github.com/chimurai/http-proxy-middleware#websocket |
@zigomir tks, I'll take a look at API. |
@EvanHunt 你好 我想问一下最后是怎么在proxyTable中设置的websocket连接 我也遇到了这样的问题 谢谢 |
@smilebuz 抱歉今天才注意到, ...
proxyTable: {
'/api': {
target: `http:${host}:${port}`,
changeOring: true,
ws: true,
}
},
... |
Websocket request is able to cross domains. Why is proxy needed for it? |
用了http://vuejs-templates.github.io/webpack/proxy.html 这个方案,还是不行(我访问的是另外一台机器的端口)。而且config.js里面proxyTable格式是固定的,我需要怎么正确配置才能跨域;
我也没有找到如何开启ws的方案;
用了https://www.npmjs.com/package/http-proxy-middleware 插件下的配置方式书写,就报错;
The text was updated successfully, but these errors were encountered: