将IIS配置为Keycloak的反向代理 [英] Configuring IIS as reverse-proxy for Keycloak
问题描述
我正在使用Keycloak 2.3.0版本,独立模式,服务器.我为在localhost:8080上运行的本地Keycloak服务器配置了IIS URL重写.
I'm using Keycloak 2.3.0 version, standalone mode, server. I configured IIS URL Rewrite for local Keycloak server running on localhost:8080.
问题在于,无法在Keycloak中指定基本url,而是Keycloak尝试检测其自己的主机/端口,并始终将端口号(8080)附加到重定向中. 我修复了配置json中除'auth-server-url'以外的所有内容.有什么办法可以使其正常工作吗?
The problem is that there is no way to specify base url in Keycloak, instead Keycloak tries to detect its own host/port and always appends port number (8080) to redirects. I fixed everything except 'auth-server-url' in config json. Is there any way to get it working?
推荐答案
我已经在反向代理后面运行 Keycloak 了一段时间.关键是:
I've been running Keycloak behind a reverse-proxy for some time. The key is:
-
要在
mydomain.com/ sso 设置的 standalone.xml
- HTTPS代理设置中正确配置它,请执行以下操作:
to have it configured properly in
standalone.xml
- HTTPS proxy settings for mydomain.com/sso settings follow:
-
<http-listener name="default"... -> <http-listener name="default" socket-binding="http" proxy-address-forwarding="true" redirect-socket="proxy-https"/>
-
<socket-binding name="http"... -> <socket-binding name="proxy-https" port="443"/>
-
<web-context>auth... -> <web-context>sso</web-context>
<http-listener name="default"... -> <http-listener name="default" socket-binding="http" proxy-address-forwarding="true" redirect-socket="proxy-https"/>
<socket-binding name="http"... -> <socket-binding name="proxy-https" port="443"/>
<web-context>auth... -> <web-context>sso</web-context>
以在与代理相同的上下文路径上运行它.例如. mydomain.com/keycloak -> localhost:8080/keycloak
to run it on the same context path as the proxy is. Eg. mydomain.com/keycloak -> localhost:8080/keycloak
这篇关于将IIS配置为Keycloak的反向代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!