gpt4 book ai didi

Is it impossible to set up a proxy on the websocket?(在网络插座上设置代理是不可能的吗?)

转载 作者:bug小助手 更新时间:2023-10-24 19:23:26 25 4
gpt4 key购买 nike



I'm making a vue project.

我在做一个VUE项目。


The same goes for React.

Reaction也是如此。


devServer {proxy:... in webpack settings...Proxy settings work for libraries installed at npmi when } is applied.

DevServer{代理:...在webpack设置中...当应用}时,代理设置适用于在npmi安装的库。


but,

但,


const script = createElement('script');

Const脚本=createElement(‘脚本’);


script.src = '/libs/libraryExample.js' // has newWebpack() inside this script

Script.src=‘/libs/LibraryExample.js’//此脚本中有newWebpack()


For libraries that you manually added to, the webpack proxy settings above do not work.

对于手动添加到的库,上面的webpack代理设置不起作用。


The current situation is

目前的情况是


back from vue -> 192.168.0.155:8080

从VUE返回->192.168.0.155:8080


↕ Must be connected to a websocket

↕必须连接到WebSocket


Back from cloud server -> 155.2.105.100

从云服务器返回->155.2.105.100


In this case, under normal circumstances

在这种情况下,在正常情况下


Just insert devServer {proxy:'https://155.2.105.100'}

只需插入DevServer{Proxy:‘https://155.2.105.100’}


Proxy will also be applied to wss://155.2.105.100.

代理也将应用于wss://155.2.105.100。


But if you add it manually like that, it doesn't work as a proxy.

但如果您像这样手动添加它,它不能作为代理工作。


Yeah, let's just customize the library!
I made up my mind

是啊,让我们来定制库吧!我下定决心了


I looked for proxy-related settings in options in new webpack(url, options),

我在新webpack的选项中寻找了与代理相关的设置(URL,选项),


Neither Google nor gpt could give an answer.

谷歌和GPT都无法给出答案。


script.src = '/libs/libraryExample.js' // has newWebpack() inside this script
I've given b multiple options in new Webpack(a,b) inside that script, but...It didn't work.

Src=‘/libs/LibraryExample.js’//在此脚本中有newWebpack()我在该脚本中为b提供了新的webpack(a,b)中的多个选项,但...它不起作用。


I've also put in the new webpack (url, {rejectUnauthorized: false }) that's spread on the Internet.

我还放入了网上流传的新webpack(url,{reputUnAuthority:FALSE})。


It doesn't seem to work with the current version of Chrome. Or it's an option that only works for xhr, not ws.

它似乎不适用于当前版本的Chrome。或者,这是一个只适用于xhr而不适用于ws的选项。


Is there any way...?

有没有办法...?


The library itself is using new webpack, not socket.io , so it's hard to replace it with anything else.

图书馆本身使用的是新的webpack,而不是Socket.IO,所以很难用其他东西来取代它。


更多回答

The "talking to self" style of this question is rather confusing, and I wonder if that will result in it not being answered. I wonder if it could do with some formatting, as there seems to be a lot of information that is not made readable.

这个问题的“自言自语”风格相当令人困惑,我想知道这会不会导致它得不到回答。我想知道它是否可以进行一些格式化,因为似乎有很多信息是不可读的。

I wonder if a paragraph at the top that summarises your problem might be useful. Are you looking to set up a web server on port 80 and a web socket on port 8080 on the same IP address?

我想知道顶部总结你的问题的一段话是否有用。您是否希望在相同的IP地址上设置端口80上的Web服务器和端口8080上的Web套接字?

优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com