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

网站设置登录账号密码后Connection errored out #89

Closed
peiyun1982 opened this issue Mar 9, 2023 · 23 comments
Closed

网站设置登录账号密码后Connection errored out #89

peiyun1982 opened this issue Mar 9, 2023 · 23 comments
Labels
👍 good 感谢您 question Further information is requested

Comments

@peiyun1982
Copy link

海外服务器,不用账号密码部署是OK的。(下图红框里是OK的)
如果设置了账号密码,访问服务器的时候会出现登录界面。但是提问时会报错。(下图蓝框里的写法都会报错)
微信截图_20230309114710
微信截图_20230309114538
想问一下这里改如何正确修改,

@GaiZhenbiao

This comment was marked as resolved.

@peiyun1982

This comment was marked as resolved.

@peiyun1982

This comment was marked as resolved.

@magehsiii
Copy link

同样遇到了这个问题,设置了账户密码就会出现 something went wrong

@GaiZhenbiao
Copy link
Owner

多试几个端口号?我在我自己的服务器上部署的时候,也设置了密码,但是没有任何问题。能提供更详细的信息吗?

@magehsiii
Copy link

magehsiii commented Mar 9, 2023

用127.0.0.1 本地调试的时候设置密码也可以登陆使用,使用公网ip启动之后,访问就会异常(但是后端没有报错,前端看点击发送按钮后,报ws连接错误,WebSocket connection to 'ws://xxxxxxxxxxxx:8099/queue/join' failed: )公网启动不设置账户密码就可以正常用

@GaiZhenbiao

This comment was marked as resolved.

@magehsiii

This comment was marked as resolved.

@peiyun1982

This comment was marked as resolved.

@dadaoerv

This comment was marked as resolved.

@magehsiii
Copy link

magehsiii commented Mar 9, 2023

image

image
看起来是ws 连接 cookie里面access-token没有取到,用ip直接访问拿到是access-token-unsecure,原来写的是access-token,routes.py文件里这个临时改下能用

@martian-yan
Copy link

image

image 看起来是ws 连接 cookie里面access-token没有取到,用ip直接访问拿到是access-token-unsecure,原来写的是access-token,routes.py文件里这个临时改下能用

遇到了同样的问题,本地部署时设置密码,一切都是正常的。在VPS上部署时,登陆之后就会显示“Connection errored out", 但是如果ssh把端口转发到本地,再用浏览器访问也是正常的。
按照你的方法修改 /usr/local/lib/python3.9/dist-packages/gradio/routes.py 之后就正常了。

@mr-apm
Copy link

mr-apm commented Mar 14, 2023

image
image 看起来是ws 连接 cookie里面access-token没有取到,用ip直接访问拿到是access-token-unsecure,原来写的是access-token,routes.py文件里这个临时改下能用

遇到了同样的问题,本地部署时设置密码,一切都是正常的。在VPS上部署时,登陆之后就会显示“Connection errored out", 但是如果ssh把端口转发到本地,再用浏览器访问也是正常的。 按照你的方法修改 /usr/local/lib/python3.9/dist-packages/gradio/routes.py 之后就正常了。

嗯,按照这个修改后就行了...

@Keldos-Li Keldos-Li changed the title 网站设置登录账号密码后就不好用了 网站设置登录账号密码后Connection errored out. Mar 14, 2023
@Keldos-Li Keldos-Li changed the title 网站设置登录账号密码后Connection errored out. 网站设置登录账号密码后Connection errored out Mar 14, 2023
@Keldos-Li Keldos-Li linked a pull request Mar 14, 2023 that will close this issue
@GaiZhenbiao GaiZhenbiao pinned this issue Mar 18, 2023
@GaiZhenbiao GaiZhenbiao unpinned this issue Mar 20, 2023
@GaiZhenbiao GaiZhenbiao pinned this issue Mar 22, 2023
@wangfeng35
Copy link

nginx反代,无账号密码,首次提问会提示Connection errored, 刷新后重新再问就好了,暂时不乱改了,刷新再用就好了。

@jackrao168

This comment was marked as outdated.

@silviaclaire
Copy link

Docker 部署后,进入容器, 在 /usr/local/lib/python3.9/dist-packages/ 是空的,根本找不到 : gradio/routes.py ,修改就谈不上了......

Dockerfile 里面在 CMD 之前加这行,重修 build 一下 image。Docker 公网部署,亲测成功。

RUN sed -i 's/websocket\.cookies\.get("access-token")/websocket.cookies.get("access-token-unsecure")/' /root/.local/lib/python3.9/site-packages/gradio/routes.py

@benja956
Copy link

Docker 部署后,进入容器, 在 /usr/local/lib/python3.9/dist-packages/ 是空的,根本找不到 : gradio/routes.py ,修改就谈不上了......

Dockerfile 里面在 CMD 之前加这行,重修 build 一下 image。Docker 公网部署,亲测成功。

RUN sed -i 's/websocket\.cookies\.get("access-token")/websocket.cookies.get("access-token-unsecure")/' /root/.local/lib/python3.9/site-packages/gradio/routes.py

感谢思路,使用一下命令解决了:
docker exec [你的容器ID] sed -i 's/websocket\.cookies\.get("access-token")/websocket.cookies.get("access-token-unsecure")/' /usr/local/lib/python3.9/site-packages/gradio/routes.py(注意路径)

@jackrao168
Copy link

Docker 部署后,进入容器, 在 /usr/local/lib/python3.9/dist-packages/ 是空的,根本找不到 : gradio/routes.py ,修改就谈不上了......

Dockerfile 里面在 CMD 之前加这行,重修 build 一下 image。Docker 公网部署,亲测成功。

RUN sed -i 's/websocket\.cookies\.get("access-token")/websocket.cookies.get("access-token-unsecure")/' /root/.local/lib/python3.9/site-packages/gradio/routes.py

按以上方法重新生成镜像后,成功解决问题,非常感谢!

@Keldos-Li
Copy link
Collaborator

Gradio ISSUE: gradio-app/gradio#3716

我们发现问题和解决办法的提出的比他们早😂

@oiuv

This comment was marked as resolved.

@tangyuxiaoyao
Copy link

docker 镜像的建议改动路径如下:
1、进入正在运行的容器
docker exec -it container-id bash
sed -i 's/websocket.cookies.get("access-token")/websocket.cookies.get("access-token-unsecure")/' /root/.local/lib/python3.9/site-packages/gradio/routes.py
exit
2、commit 成最新镜像包,防止下次重启有问题
docker commit container-id chatgpt-chuanhu:latest
3、停止并删除之前正在运行的container
docker rm chatgpt -f
4、启动的时候使用最新的镜像即可(apihost不需要带协议,踩坑了……)
docker run -d --name chatgpt
-e my_api_key="sk-xxx"
-e api_host="abc.1232.com" \
-e USERNAME="123"
-e PASSWORD="312@3131321"
-v ~/chatGPThistory:/app/history
-p xxxx:7860
chatgpt-chuanhu:latest

@Keldos-Li Keldos-Li unpinned this issue Apr 23, 2023
@liutaocode
Copy link

问题还是存在

@Keldos-Li
Copy link
Collaborator

Keldos-Li commented Sep 22, 2023

@liutaocode 我们确信使用新版本的gradio之后原始问题已被解决,而且我们新版本的程序不再使用当时的config设置,这里提供的解决办法已经不再适用。如果你还遇到类似的问题,请开启一个新的issue,并提供更详细的说明。

Repository owner locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
👍 good 感谢您 question Further information is requested
Projects
None yet
Development

No branches or pull requests