Closed wzlee closed 4 years ago
支持websocket代理啊:
// config/proxy.js
export default {
dev: {
'/api/': {
target: 'http://localhost:8888',
changeOrigin: true,
secure: false,
pathRewrite: {
'^/api': '/api',
},
},
// websocket代理
'/ws/': {
target: 'ws://localhost:8889',
ws: true,
logLevel: 'debug',
secure: false,
pathRewrite: {
'^/ws': '',
},
},
},
}
支持websocket代理啊:
// config / proxy.js 导出 默认值 { dev:{ '/ api /':{ 目标:'http:// localhost:8888' , changeOrigin:true , secure:false , pathRewrite:{ '^ / api':' / api' , } , } , // websocket代理 '/ ws /':{ target:'ws:// localhost:8889' , ws:true , logLevel:'debug', secure:false , pathRewrite:{ '^ / ws':'' , } , } , } , }
老哥 这样配置完成后,应该怎么使用啊,在线求方案
支持websocket代理啊:
// config / proxy.js 导出 默认值 { dev:{ '/ api /':{ 目标:'http:// localhost:8888' , changeOrigin:true , secure:false , pathRewrite:{ '^ / api':' / api' , } , } , // websocket代理 '/ ws /':{ target:'ws:// localhost:8889' , ws:true , logLevel:'debug', secure:false , pathRewrite:{ '^ / ws':'' , } , } , } , }
老哥 这样配置完成后,应该怎么使用啊,在线求方案
参考一下这个吧 https://blog.csdn.net/u013897323/article/details/106330388
协议、地址、端口动态获取一下,然后拼接成你的wsSourceUrl
按照她这样写 好像链接都建立不上
------------------ 原始邮件 ------------------ 发件人: "ant-design/ant-design-pro" <notifications@github.com>; 发送时间: 2020年9月1日(星期二) 晚上6:33 收件人: "ant-design/ant-design-pro"<ant-design-pro@noreply.github.com>; 抄送: "S"<461377096@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [ant-design/ant-design-pro] 可否支持类似这样的websocket的proxy相关配置 (#6813)
支持websocket代理啊: // config / proxy.js 导出 默认值 { dev:{ '/ api /':{ 目标:'http:// localhost:8888' , changeOrigin:true , secure:false , pathRewrite:{ '^ / api':' / api' , } , } , // websocket代理 '/ ws /':{ target:'ws:// localhost:8889' , ws:true , logLevel:'debug', secure:false , pathRewrite:{ '^ / ws':'' , } , } , } , }
老哥 这样配置完成后,应该怎么使用啊,在线求方案
参考一下这个吧 https://blog.csdn.net/u013897323/article/details/106330388 协议、地址、端口动态获取一下,然后拼接成你的wsSourceUrl
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
@sayPink 生成的链接能贴一下吗
这个是生成的链接ws://localhost:8000/ws/admin/ws/conn
然后我代理配置是这么写
老哥能加你个联系方式吗
------------------ 原始邮件 ------------------ 发件人: "ant-design/ant-design-pro" <notifications@github.com>; 发送时间: 2020年9月1日(星期二) 晚上7:37 收件人: "ant-design/ant-design-pro"<ant-design-pro@noreply.github.com>; 抄送: "S"<461377096@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [ant-design/ant-design-pro] 可否支持类似这样的websocket的proxy相关配置 (#6813)
@sayPink 生成的链接能贴一下吗
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
感谢老哥, 已经找到问题 是我代理的时候 位置摆放错了,感谢老哥万忙之中抽空解答 谢谢 ------------------ 原始邮件 ------------------ 发件人: "ant-design/ant-design-pro" <notifications@github.com>; 发送时间: 2020年9月1日(星期二) 晚上7:37 收件人: "ant-design/ant-design-pro"<ant-design-pro@noreply.github.com>; 抄送: "S"<461377096@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [ant-design/ant-design-pro] 可否支持类似这样的websocket的proxy相关配置 (#6813)
@sayPink 生成的链接能贴一下吗
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
感谢老哥, 已经找到问题 是我代理的时候 位置摆放错了,感谢老哥万忙之中抽空解答 谢谢 ------------------ 原始邮件 ------------------ 发件人: "ant-design/ant-design-pro" <notifications@github.com>; 发送时间: 2020年9月1日(星期二) 晚上7:37 收件人: "ant-design/ant-design-pro"<ant-design-pro@noreply.github.com>; 抄送: "S"<461377096@qq.com>;"Mention"<mention@noreply.github.com>; 主题: Re: [ant-design/ant-design-pro] 可否支持类似这样的websocket的proxy相关配置 (#6813) @sayPink 生成的链接能贴一下吗 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
确定可以?能贴下代码吗
🥰 需求描述
项目中遇到需要使用websocket的组件,但需要独立配置url,但无法使用config.ts中的proxy配置