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

[Bug] 如何才能让Lobe客户端版本Docker镜像通过HTTP Proxy访问互联网? #6524

Closed
zhufeizzz opened this issue Feb 26, 2025 · 10 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@zhufeizzz
Copy link

zhufeizzz commented Feb 26, 2025

📦 部署环境

Docker

📦 部署模式

客户端 Pglite 模式(lobe-chat-pglite 镜像)

📌 软件版本

1.62.3

💻 系统环境

Other Linux

🌐 浏览器

Edge

🐛 问题描述

我的Linux服务器无法直接联网,但是可以通过HTTP Proxy访问互联网。
PS:这个HTTP Proxy功能是正常的,其它Linux程序均可以正常访问互联网。

使用docker run lobe-chat镜像时,不管如何设置HTTP Proxy,Lobe容器均无法联网,导致部分功能不可用.
1、直接使用宿主机的PROXY环境变量设置,不行。
2、使用宿主机的PROXY环境变量设置 + docker_network=host,不行。
3、docker -e中设置PROXY环境变量,不行。
4、怀疑是Proxy环境变量设置和Dockerfile CMD执行顺序的问题,docker run手工覆盖cmd和和entrypoint,不行。

容器启动命令

docker run -p 3210:3210 --env-file ./lobe.env  --name=lobe-chat-pglite --restart=always lobehub/lobe-chat-pglite

Proxy设置

HTTP_PROXY=http://xx.xx.xx.xx:3128
HTTPS_PROXY=http://xx.xx.xx.xx:3128
NO_PROXY=localhost,127.0.0.1

Lobe访问互联网报错

[rewrite] /discover -> http://127.0.0.1:3210/zh-CN__0__light/discover
Error getting changelog lists: TypeError: fetch failed
    at async f.getChangelogIndex (.next/server/app/[variants]/(main)/changelog/page.js:27:37259)
    at async f.getLatestChangelogId (.next/server/app/[variants]/(main)/changelog/page.js:27:37118)
    at async m (.next/server/app/[variants]/(main)/chat/(workspace)/page.js:1639:23030) {
  [cause]: [Error [ConnectTimeoutError]: Connect Timeout Error (attempted addresses: 185.199.108.133:443, 185.199.111.133:443, 185.199.109.133:443, 185.199.110.133:443, timeout: 10000ms)] {
    code: 'UND_ERR_CONNECT_TIMEOUT'
  }
}
Error: fetch failed
    at context.fetch (/app/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected]_react-dom@19._dpqdy2s6ykudta5c6xlgnxgea4/node_modules/next/dist/server/web/sandbox/context.js:303:38)

Image

📷 复现步骤

No response

🚦 期望结果

No response

📝 补充信息

No response

@zhufeizzz zhufeizzz added the 🐛 Bug Something isn't working | 缺陷 label Feb 26, 2025
@github-project-automation github-project-automation bot moved this to Roadmap - Chat 1.x in Lobe Chat Routine Feb 26, 2025
@lobehubbot
Copy link
Member

👀 @zhufeizzz

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

Copy link

dosubot bot commented Feb 26, 2025

To configure the Lobe client Docker image to access the internet through an HTTP Proxy, you can follow these steps:

  1. Set Proxy Environment Variables: Ensure that the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables are correctly set in your Docker environment. You can do this by specifying them in your lobe.env file or directly in the docker run command using the -e flag.

  2. Check Dockerfile Configuration: The Lobe client Docker image uses proxychains-ng to route network traffic through a proxy. Ensure that the proxychains-ng configuration is correctly set up in the Dockerfile. The relevant configuration files should be copied to the distroless environment within the Docker image.

  3. Use Proxychains: If the proxy settings are not being applied, you might need to ensure that proxychains is being used to start the application. This can be done by modifying the CMD or ENTRYPOINT in the Dockerfile to prepend proxychains to the command that starts your application.

  4. Verify Network Configuration: Double-check that there are no network restrictions or firewall rules on your Linux server that might be blocking the proxy connection.

  5. Restart Docker Containers: After making changes to the proxy settings, restart your Docker containers to apply the changes.

If these steps do not resolve the issue, you might want to look into the specific configuration of proxychains-ng and ensure that it is correctly routing traffic through your specified proxy server.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@arvinxx
Copy link
Contributor

arvinxx commented Feb 26, 2025

@hezhijie0327 帮忙看下?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@hezhijie0327 Help to see it?

@hezhijie0327
Copy link
Contributor

hezhijie0327 commented Feb 26, 2025 via email

@SAnBlog
Copy link

SAnBlog commented Feb 26, 2025

设置 PROXY_URL 参数,如 PROXY_URL=socks5://127.0.0.1:7890

获取 Outlook for iOShttps://aka.ms/o0ukef

http协议是 PROXY_URL=http://127.0.0.1:7890 ?
配置后是全局都走这个代理吗?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Set the PROXY_URL parameter, such as PROXY_URL=socks5://127.0.0.1:7890

Get Outlook for iOShttps://aka.ms/o0ukef

The http protocol is PROXY_URL=http://127.0.0.1:7890?
After configuration, will this agent be used globally?

@zhufeizzz
Copy link
Author

可以了,感谢大佬,这问题我之前研究了好久

@github-project-automation github-project-automation bot moved this from Roadmap - Chat 1.x to Done in Lobe Chat Routine Feb 26, 2025
@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


OK, thank you guys, I have studied this issue for a long time before

@lobehubbot
Copy link
Member

@zhufeizzz

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Status: Done
Development

No branches or pull requests

5 participants