gpt4 book ai didi

nginx - github oauth 和 nginx 代理

转载 作者:行者123 更新时间:2023-12-01 10:09:39 24 4
gpt4 key购买 nike

我觉得我已经搜索了整个互联网并尝试了几乎所有方法来解决我的问题。现在我决定问你,希望有人能帮助我。

我有一个在 sub2.domain.tld:3000 上运行的节点应用程序。现在我想使用 nginx 将此应用程序代理到端口 80,以便我能够使用 sub.domain.tld 访问该应用程序。但这不是问题。我能够到达第一个站点。

这个问题跟在一个带有 OAuth-API 的身份验证例程之后。验证应用程序的用户。

当浏览到 sub2.domain.tld:3000 时,该过程运行正常。但是当我更改配置中的 url 并尝试浏览到 sub.domain.tld 时,身份验证过程会遇到错误(error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL.... .).

所以我想我在使用 nginx 重定向 url 时犯了一个错误。

我正在使用 nginx 1.4.7 和节点 0.10.26

我的 nginx 配置文件如下所示:

server {
listen 80;
access_log /var/log/nginx/access_log_sub;
server_name sub.domain.tld;

location / {
include proxy_params;
proxy_pass http://IP:3000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Client-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
}
}

但我相信 OAuth 正在验证 sub2.domain.tld:3000 并且它与 sub.domain.tld 发生冲突

我希望你能帮助我,解决这个问题。

最佳答案

错误不是来自 nginx,而是来自您的 OAuth 提供商:

The redirect_uri parameter is optional. If left out, GitHub will redirect users to the callback URL configured in the OAuth Application settings. If provided, the redirect URL's host and port must exactly match the callback URL. The redirect URL's path must reference a subdirectory of the callback URL.

-- https://developer.github.com/v3/oauth/#redirect-urls

关于nginx - github oauth 和 nginx 代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23279769/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com