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] PROXY_URL不支持使用密码的用户代理,解析不正确 #695

Closed
WF1683497569 opened this issue Apr 10, 2023 · 11 comments
Closed
Labels
enhancement New feature or request low priority

Comments

@WF1683497569
Copy link

描述问题
PROXY_URL不支持使用密码的用户代理,如http://user:password@127.0.0.1:7890

如何复现
使用Docker执行:
docker run -d -p 3000:3000
-e OPENAI_API_KEY="sk-xxxx"
-e CODE="your-password"
-e PROXY_URL="http://user:password@127.0.0.1:7890"
yidadaa/chatgpt-next-web

截图
ubuntu@VM-16-14-ubuntu:/opt/app/chatgpt-next-web$ ./startup.sh
[+] Running 1/1
⠿ Container chat-next-web Started 0.5s
strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
http fwei 123456788@10.0.16.14
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
proxy fwei has invalid value or is not numeric
non-numeric ips are only allowed under the following circumstances:
chaintype == strict (true), proxy is not first in list (false), proxy_dns active (thread)
图片

一些必要的信息

  • 系统:linux
  • 浏览器:-
  • 版本: latest
  • 部署方式:docker
@WF1683497569 WF1683497569 changed the title [Bug] [Bug] PROXY_URL不支持使用密码的用户代理,解析不正确 Apr 10, 2023
@Yidadaa Yidadaa added the enhancement New feature or request label Apr 10, 2023
@Yidadaa
Copy link
Collaborator

Yidadaa commented Apr 10, 2023

不算是 bug,因为我没说它支持

@yinm0591
Copy link
Contributor

我查了资料,将:
echo "$protocol $host $port" >> $conf;
改成:
echo "$protocol $host $port $PROXY_USER $PROXY_PASSWD" >> $conf;

然后配置2个环境变量 $PROXY_USER、$PROXY_PASSWD应该就可以实现这个功能了

@yinm0591
Copy link
Contributor

@WF1683497569

当前版本有1个讨巧的办法,你可以试试:
-e PROXY_URL="http://127.0.0.1:7890 user pass"

@Yidadaa
Copy link
Collaborator

Yidadaa commented Apr 11, 2023

需要更新 DockerFile 的 proxy 部分,使用下列脚本:

function split() {
    echo $1 | awk -F $2 '{print $1,$2}'
}

function parse_config() {
    local input=$1
    read protocol rest <<< "$(split $input '://')"
    read userpass hostport <<< "$(split $rest '@')"
    read user pass <<< "$(split $userpass ':')"
    read host port <<< "$(split $hostport ':')"

    echo "$protocol $host $port $user $pass"
}

parse_config $1

@arvinws
Copy link

arvinws commented May 26, 2023

同问

@JDxiaojuju
Copy link

容器里可以配置代理嘛,能实现本地不开代理也能访问到chatgpt嘛

@peefau
Copy link

peefau commented Jun 15, 2023

PROXY_URL只支持http代理而不支持socks5代理吗

@ilolita945
Copy link

@WF1683497569

当前版本有1个讨巧的办法,你可以试试: -e PROXY_URL="http://127.0.0.1:7890 user pass"

感谢,能解决问题

@Issues-translate-bot
Copy link

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


@WF1683497569

The current version has a tricky way, you can try: -e PROXY_URL="http://127.0.0.1:7890 user pass"

Thanks, can solve the problem

@Yidadaa
Copy link
Collaborator

Yidadaa commented Jun 23, 2023

收录至 #2105

@Yidadaa Yidadaa closed this as completed Jun 23, 2023
@Issues-translate-bot
Copy link

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


Included in #2105

Yidadaa added a commit that referenced this issue Jun 23, 2023
doc: #695 how to use a proxy with password in docker
alchemist139 pushed a commit to alchemist139/ChatGPT-Next-Web that referenced this issue Sep 21, 2023
alchemist139 pushed a commit to alchemist139/ChatGPT-Next-Web that referenced this issue Sep 21, 2023
chenzeyu pushed a commit to neutronsg/ChatGPT-Next-Web that referenced this issue Nov 8, 2023
gaogao1030 pushed a commit to gaogao1030/ChatGPT-Next-Web that referenced this issue May 16, 2024
gaogao1030 pushed a commit to gaogao1030/ChatGPT-Next-Web that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority
Projects
None yet
Development

No branches or pull requests

8 participants