ChatGPTNextWeb / ChatGPT-Next-Web

A cross-platform ChatGPT/Gemini UI (Web / PWA / Linux / Win / MacOS). 一键拥有你自己的跨平台 ChatGPT/Gemini 应用。
https://app.nextchat.dev/
MIT License
73k stars 57.98k forks source link

Dockerfile: Listen to any addresses instead of localhost, fixes #4682 #4689

Closed ReeseWang closed 1 month ago

vercel[bot] commented 2 months ago

@ReeseWang is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

github-actions[bot] commented 2 months ago

Your build has completed!

[Preview deployment]()

ReeseWang commented 2 months ago

HOSTNAME=127.0.0.1是在 #1738 引入的,目的是解决proxychains代理本地地址的问题。首先我觉得proxychains不会使用HOSTNAME这个环境变量,其次HOSTNAME这个变量会被nodejs拿来作为监听地址,而监听127.0.0.1会拒绝一切从外部来的连接。

编辑:我大概明白为什么有HOSTNAME=127.0.0.1了,见#1556。nodejs想访问本机的时候用的是HOSTNAME环境变量作为域名,被解析到了192.168.0.0/16,10.0.0.0/8,172.16.0.0/12和公网这样的地址上,然后proxychains会试图用代理服务器访问这些地址。

Issues-translate-bot commented 2 months ago

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


HOSTNAME=127.0.0.1 was introduced in #1738 to solve the problem of proxychains proxying local addresses. First of all, I think proxychains will not use the HOSTNAME environment variable. Secondly, the HOSTNAME variable will be used by nodejs as the listening address, and listening on 127.0.0.1 will reject all connections from the outside.

ReeseWang commented 2 months ago

新观察到的行为:在HOSTNAME/etc/hostname保持一致的情况下,如果用proxychains启动nodejs,nodejs会监听127.0.0.1:3000,无法从外部访问。所以我前一个commit把HOSTNAME设置为0.0.0.0是正确的。

proxychains太不科学了,彻底解决问题的方法是把它扔掉。

Issues-translate-bot commented 2 months ago

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


Newly observed behavior: When HOSTNAME and /etc/hostname are consistent, if nodejs is started with proxychains, nodejs will listen on 127.0.0.1:3000 and cannot be accessed from the outside. So my previous commit set HOSTNAME to 0.0.0.0 which is correct.

Proxychains is so unscientific that the only way to completely solve the problem is to throw it away.

fred-bf commented 2 months ago

Hi @ReeseWang would you mind check whether the latest commit works as expected, I just customized the nodejs listen address with --host flag

ReeseWang commented 2 months ago

@fred-bf Nope, still listening on 127.0.0.1.