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] 20230505Docker版本的http auth问题 #1305

Closed
franocisgar opened this issue May 6, 2023 · 4 comments
Closed

[Bug] 20230505Docker版本的http auth问题 #1305

franocisgar opened this issue May 6, 2023 · 4 comments

Comments

@franocisgar
Copy link

用docker部署后,nginx反代同时使用http auth后,会不断要求重新验证,用user:pass@domain 来登录的话就会输入授权密码后就直接

出错了,稍后重试吧

之前还是可以用http auth前置反代的。

@Yidadaa
Copy link
Collaborator

Yidadaa commented May 6, 2023

#741 (comment)

@Yidadaa Yidadaa closed this as completed May 6, 2023
@hibobmaster
Copy link
Contributor

@Yidadaa 这里能不能换个请求头,Authorization 和 basic_auth 的请求头冲突
https://github.com/Yidadaa/ChatGPT-Next-Web/blob/bc523d302b7c05050a71cf0460588049aab9d2f9/app/api/auth.ts#L30
我看原来貌似用的是 token 来获取用户输入的api key
应该是这个 commit 引入的: 48ebd74

@Ma-Chang-an
Copy link

Ma-Chang-an commented Nov 10, 2023

@Yidadaa 这里能不能换个请求头,Authorization 和 basic_auth 的请求头冲突

https://github.com/Yidadaa/ChatGPT-Next-Web/blob/bc523d302b7c05050a71cf0460588049aab9d2f9/app/api/auth.ts#L30

我看原来貌似用的是 token 来获取用户输入的api key
应该是这个 commit 引入的: 48ebd74

@Yidadaa 我有同样的问题,我使用华为云FunctionGraph来部署了ChatGPT-Next-Web,通过华为云的APIG网关来访问页面,当不适用密码是访问正常,可以正常chat,但是当我设置了Code环境变量,并在设置页面输入了密码后,所有HTTPS请求都会被APIG网关拦截,报错401认证错误,原因就是华为云的APIG网关会使用Authorization字段进行鉴权,但是ChatGPT-Next-Web的前端会把密码、API key得信息填写到Authorization字段导致华为云APIG网关鉴权失败,所以建议换一个请求头域段来承载这两个信息,下面是我测试过程的截图,图一是不使用Code密码的访问情况,
image

图二是使用CODE密码的访问情况
image

@Issues-translate-bot
Copy link

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


@Yidadaa Can you change the request header here? Authorization conflicts with the request header of basic_auth

https://github.com/Yidadaa/ChatGPT-Next-Web/blob/bc523d302b7c05050a71cf0460588049aab9d2f9/app/api/auth.ts#L30

It seems that token is used to obtain the api key entered by the user.
It should be introduced by this commit: 48ebd74

@Yidadaa I have the same problem. I used Huawei Cloud FunctionGraph to deploy ChatGPT-Next-Web and accessed the page through Huawei Cloud's APIG gateway. When the password is not applicable, the access is normal and chat can be normal, but when I set the Code After setting the environment variable and entering the password on the settings page, all HTTPS requests will be intercepted by the APIG gateway and a 401 authentication error will be reported. The reason is that Huawei Cloud's APIG gateway will use the Authorization field for authentication, but the front end of ChatGPT-Next-Web will Filling in the password and API key information into the Authorization field caused Huawei Cloud APIG gateway authentication to fail. Therefore, it is recommended to change a request header field to carry these two information. The following is a screenshot of my test process. Figure 1 does not use the Code password. The access situation, Figure 2 shows the access situation using CODE password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants