Skip to content
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

关于PROXY_URL环境变量的问题 #1569

Closed
lukesyy opened this issue May 17, 2023 · 22 comments
Closed

关于PROXY_URL环境变量的问题 #1569

lukesyy opened this issue May 17, 2023 · 22 comments
Labels
faq Most asked questions

Comments

@lukesyy
Copy link

lukesyy commented May 17, 2023

微信截图_20230517154706
1111

我不知道 我哪里配置的有问题 我测试了socks5 是可用的 但还是连接不上openai

@lukesyy lukesyy changed the title [Feature] 关于PROXY_URL环境变量的问题 May 17, 2023
@Yidadaa
Copy link
Collaborator

Yidadaa commented May 17, 2023

尝试改成 http 端口

@lukesyy
Copy link
Author

lukesyy commented May 17, 2023

http 需要加 --net=host \ 吗

@Yidadaa
Copy link
Collaborator

Yidadaa commented May 17, 2023

你可以试试,我自己不用 docker

@lukesyy
Copy link
Author

lukesyy commented May 17, 2023

还是不行,我在研究研究其他方式

@Yidadaa
Copy link
Collaborator

Yidadaa commented May 17, 2023

如果有任何结论,烦请更新在此处。

@Yidadaa
Copy link
Collaborator

Yidadaa commented May 17, 2023

#1556 或许也是类似的问题

@lukesyy
Copy link
Author

lukesyy commented May 17, 2023

我觉得是docker的问题 服务器本地的localhost 感觉这个docker访问不到。

@lukesyy
Copy link
Author

lukesyy commented May 17, 2023

15155

解决了 docker访问不到 localhost 需要服务器的真实IP

@Yidadaa Yidadaa added the faq Most asked questions label May 17, 2023
@Yidadaa
Copy link
Collaborator

Yidadaa commented May 17, 2023

所以不能使用 localhost,应该用宿主机在的局域网 ip?

@lukesyy
Copy link
Author

lukesyy commented May 17, 2023

是的

@yinm0591
Copy link
Contributor

yinm0591 commented May 17, 2023

docker容器访问宿主机的proxy,有3种方案:

  1. 宿主机代理是127.0.0.1, docker容器要加--network host参数,容器才能通过127.0.0.1访问到宿主机的代理。由于容器里的3000端口是绑在ipv6上的,所以必须使用IPV6地址才能访问到容器里的chatgpt next web,例如nginx反代使用地址 [::1]:3000 。
  2. 代理设为宿主机ip地址,docker容器通过ip地址访问宿主机代理。这种方式要留意2点:(1)宿主机本地防火墙(如有)需要开放端口 (2)代理可能会暴露在公网
  3. 代理设为容器网段的网关ip地址,例如容器ip是172.18.0.2,宿主机有1个对应的172.18.0.1网关,代理配置成这个172.18.0.1。这种方式类似第2种方式,宿主机也需要本地防火墙(如有)开放端口,但不用担心暴露在公网的问题。

@wayne-ss
Copy link

补充一个我的经验,我自己使用mac docker desktop + docker-compose,已经在docker中设置了proxy (Settings -> Resources -> Proxies)

HTTP: http://127.0.0.1:7890
HTTPS: http://127.0.0.1:7890

这种情况下,不需要再设置.env中的proxy字段了,直接留空,也不需要network=host

@lukesyy
Copy link
Author

lukesyy commented May 17, 2023

补充一个我的经验,我自己使用mac docker desktop + docker-compose,已经在docker中设置了proxy (Settings -> Resources -> Proxies)

HTTP: http://127.0.0.1:7890
HTTPS: http://127.0.0.1:7890

这种情况下,不需要再设置.env中的proxy字段了,直接留空,也不需要network=host

是的,我用了这种方法 我是在linux 服务器上试了试 应该是我配置的不对 没有啥效果 https://cloud.tencent.com/developer/article/1806455

@Yidadaa
Copy link
Collaborator

Yidadaa commented May 17, 2023

已经补充到项目 faq

@yinm0591
Copy link
Contributor

@Yidadaa 容器里的web server绑定的是ipv6地址,下面的指令查看的:

 docker exec [容器名称] netstat -n -a | grep 3000

docker的ipv6兼容性不佳,是不是绑定容器里的ipv4地址3000端口会更好些?

@123aluo
Copy link

123aluo commented May 22, 2023

用windows10 部署的,这个也是因为代理导致的吧,有什么好的解决办法么
image

@yanxile
Copy link

yanxile commented Jun 6, 2023

用windows10 部署的,这个也是因为代理导致的吧,有什么好的解决办法么 image

@123aluo 我是win10的docker desktop 用wsl部署的。试了要用局域网IP。192.168.x.x的。具体ipconfig自己看吧。

@Yidadaa
Copy link
Collaborator

Yidadaa commented Jun 23, 2023

收集至 #2105

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Collected at #2105

@willfulpeople
Copy link

{
"error": true,
"message": "Failed to fetch"
}

@saber09130605
Copy link

本地调试的时候一直都是
{ "cause": { "errno": -4077, "code": "ECONNRESET", "syscall": "read" } }
,如何才能本地调试啊,想加个文件检索功能

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


When debugging locally, it is always
{ "cause": { "errno": -4077, "code": "ECONNRESET", "syscall": "read" } }
, how can I debug it locally? I want to add a file retrieval function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq Most asked questions
Projects
None yet
Development

No branches or pull requests

9 participants