ChatGPTNextWeb / ChatGPT-Next-Web

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

[Bug] 更新Docker镜像到2.12.3之后,无法使用PROXY_URL字段 #4747

Closed yangxiang92 closed 1 month ago

yangxiang92 commented 1 month ago

Bug Description

更新Docker镜像到2.12.3之后,使用PROXY_URL字段,容器无法正常运行。去掉PROXY_URL字段后,容器可以正常运行。

Steps to Reproduce

运行脚本

docker run -d -p 3002:3000 \
    -e OPENAI_API_KEY=${API_KEY} \
    -e CODE="aaaaaa" \
    -e PROXY_URL="socks5://192.168.0.245:7890" \
    -e CUSTOM_MODELS="-all,+gpt-3.5-turbo,+gpt-4-turbo,+gpt-4o" \
    -e HIDE_USER_API_KEY=1 \
    --name chatgpt_next_web_test \
    --restart always \
    yidadaa/chatgpt-next-web

访问http://localhost:3002 ,得到结果如下:

image

修改脚本为:

docker run -d -p 3002:3000 \
    -e OPENAI_API_KEY=${API_KEY} \
    -e CODE="aaaaaa" \
    -e CUSTOM_MODELS="-all,+gpt-3.5-turbo,+gpt-4-turbo,+gpt-4o" \
    -e HIDE_USER_API_KEY=1 \
    --name chatgpt_next_web_test \
    --restart always \
    yidadaa/chatgpt-next-web

访问http://localhost:3002 ,得到结果如下:

image

Expected Behavior

定义了PROXY_URL后,容器仍可以正常使用。

Screenshots

No response

Deployment Method

Desktop OS

Ubuntu

Desktop Browser

Chrome

Desktop Browser Version

Version 122.0.6261.111 (Official Build) (64-bit)

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

Issues-translate-bot commented 1 month ago

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


Title: [Bug] After updating the Docker image to 2.12.3, the PROXY_URL field cannot be used

liu0050 commented 1 month ago

我也遇到了同样的问题,升级到2.12.3版本后容器无法再使用主机的代理。 image

Issues-translate-bot commented 1 month ago

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


I also encountered the same problem. After upgrading to version 2.12.3, the container can no longer use the host's agent. image

fred-bf commented 1 month ago

@liu0050 @yangxiang92 would you mind try rebuild the latest commit's docker image to see whether the issue have been resolved?

yangxiang92 commented 1 month ago

@liu0050 @yangxiang92 would you mind try rebuild the latest commit's docker image to see whether the issue have been resolved?

I have rebuild docker image with the latest commit of "main" branch (commit id: 38664487a091bedc5b4b2efec5320c74222c9432). The issue is not resolved yet.

nutinshell commented 1 month ago

Just remove the quotes from the proxychains -f $conf line in the Dockerfile. Fixed for me.

yangxiang92 commented 1 month ago

Just remove the quotes from the proxychains -f $conf line in the Dockerfile. Fixed for me.

But I need the proxy to access the OpenAI server...

nutinshell commented 1 month ago

Just remove the quotes from the proxychains -f $conf line in the Dockerfile. Fixed for me.

But I need the proxy to access the OpenAI server...

Yes, that's the right fix for proxy...

yangxiang92 commented 1 month ago

Just remove the quotes from the proxychains -f $conf line in the Dockerfile. Fixed for me.

But I need the proxy to access the OpenAI server...

Yes, that's the right fix for proxy...

Sorry, I misunderstood your meaning. Removing the quotes solves this issue! Thank you!

For reference, here is the modified content:

CMD if [ -n "$PROXY_URL" ]; then \
    export HOSTNAME="127.0.0.1"; \
    protocol=$(echo $PROXY_URL | cut -d: -f1); \
    host=$(echo $PROXY_URL | cut -d/ -f3 | cut -d: -f1); \
    port=$(echo $PROXY_URL | cut -d: -f3); \
    conf=/etc/proxychains.conf; \
    echo "strict_chain" > $conf; \
    echo "proxy_dns" >> $conf; \
    echo "remote_dns_subnet 224" >> $conf; \
    echo "tcp_read_time_out 15000" >> $conf; \
    echo "tcp_connect_time_out 8000" >> $conf; \
    echo "localnet 127.0.0.0/255.0.0.0" >> $conf; \
    echo "localnet ::1/128" >> $conf; \
    echo "[ProxyList]" >> $conf; \
    echo "$protocol $host $port" >> $conf; \
    cat /etc/proxychains.conf; \
    proxychains -f $conf node server.js --host 0.0.0.0; \
    else \
    node server.js; \
    fi