执行 DNS 翻转时 OIDC 的问题
Issues with OIDC while performing DNS Flip
我们最近在 Rails 应用程序集成环境中执行了 DNS 翻转。我们将 example-1.com 设置为指向 A 记录 example-2.com 的 CNAME。 example-2.com 处的服务是一个 Ruby on Rails 应用程序,使用 Apache 和 Passenger Phusion。在 Apache 之上,我们使用 OpenId-Connect(特别是 mod_auth_openidc 模块)。
当我们尝试直接访问 example-1.com 时,一切正常。但是当我们尝试通过 example-2.com 这样做时,我们得到以下错误:
[Thu Aug 27 19:56:37.202141 2020] [auth_openidc:error] [pid 23165]
[client xx.xx.xxx.xx:29188] oidc_authenticate_user: the URL hostname
(example-1.com) of the configured OIDCRedirectURI does not match the URL hostname
of the URL being accessed (example-2.com): the "state" and "session" cookies will
not be shared between the two!
在我们的 .confd 文件中,我们有 OIDC_REDIRECT_URI = "https://example-1.com/redirect"
.
我们认为我们可能不得不使用 Apache 重写部分请求来解决这个问题,但我们并不完全确定。有谁知道最好的前进方式?
您可以为 OIDCRedirectURI
使用相对值,因此:
OIDCRedirectURI /redirect
如文档所述:
(Mandatory)
The redirect_uri for this OpenID Connect client; this is a vanity URL
that must ONLY point to a path on your server protected by this module
but it must NOT point to any actual content that needs to be served.
You can use a relative URL like /protected/redirect_uri if you want to
support multiple vhosts that belong to the same security domain in a dynamic way
#OIDCRedirectURI https://www.example.com/protected/redirect_uri
我们最近在 Rails 应用程序集成环境中执行了 DNS 翻转。我们将 example-1.com 设置为指向 A 记录 example-2.com 的 CNAME。 example-2.com 处的服务是一个 Ruby on Rails 应用程序,使用 Apache 和 Passenger Phusion。在 Apache 之上,我们使用 OpenId-Connect(特别是 mod_auth_openidc 模块)。
当我们尝试直接访问 example-1.com 时,一切正常。但是当我们尝试通过 example-2.com 这样做时,我们得到以下错误:
[Thu Aug 27 19:56:37.202141 2020] [auth_openidc:error] [pid 23165]
[client xx.xx.xxx.xx:29188] oidc_authenticate_user: the URL hostname
(example-1.com) of the configured OIDCRedirectURI does not match the URL hostname
of the URL being accessed (example-2.com): the "state" and "session" cookies will
not be shared between the two!
在我们的 .confd 文件中,我们有 OIDC_REDIRECT_URI = "https://example-1.com/redirect"
.
我们认为我们可能不得不使用 Apache 重写部分请求来解决这个问题,但我们并不完全确定。有谁知道最好的前进方式?
您可以为 OIDCRedirectURI
使用相对值,因此:
OIDCRedirectURI /redirect
如文档所述:
(Mandatory) The redirect_uri for this OpenID Connect client; this is a vanity URL that must ONLY point to a path on your server protected by this module but it must NOT point to any actual content that needs to be served. You can use a relative URL like /protected/redirect_uri if you want to support multiple vhosts that belong to the same security domain in a dynamic way
#OIDCRedirectURI https://www.example.com/protected/redirect_uri