Jboss 反向代理后的KeyClope重定向

Jboss 反向代理后的KeyClope重定向,jboss,keycloak,Jboss,Keycloak,我正试图让Keyclope在kubernetes的一个金刚入口后面运行。我遇到的问题是keydape在返回的URL中添加了一个它认为自己所在的端口。 请求:auth.mydomain.com/auth 响应:auth.mydomain.com:8443/auth/admin/master/console/ 客户->NLB:443->孔:8443->钥匙斗篷:8080 keydepeat可以看到kong设置的请求x-forwarded-port:8443,并在port8443 Kong现在必须在8

我正试图让Keyclope在kubernetes的一个金刚入口后面运行。我遇到的问题是keydape在返回的URL中添加了一个它认为自己所在的端口。 请求:
auth.mydomain.com/auth
响应:
auth.mydomain.com:8443/auth/admin/master/console/

客户->NLB:443->孔:8443->钥匙斗篷:8080

keydepeat可以看到kong设置的请求
x-forwarded-port:8443
,并在port
8443

Kong现在必须在8443上,因为它是在用户Kong的容器中启动的,并且没有访问特权端口的权限

我已经设置了configs keydrope建议的

/socket-binding-group=standard-sockets/socket-binding=proxy-https:add(port=443)
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=redirect-socket, value=proxy-https)
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=proxy-address-forwarding, value=true)
但是这些看起来像是告诉undertow用443回复如果请求是纯文本的,那么my
x-forwarded-proto:https
设置正确

问题也可能是主机的头

----------------------------REQUEST---------------------------
               URI=/auth/admin/
 characterEncoding=null
     contentLength=-1
       contentType=null
            header=X-Real-IP=<REDACTED>
            header=Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
            header=Accept-Language=en-us
            header=Accept-Encoding=br, gzip, deflate
            header=User-Agent=<REDACTED>
            header=Connection=keep-alive
            header=X-Forwarded-Proto=https
            header=X-Forwarded-Port=8443
            header=X-Forwarded-For=<REDACTED>
            header=Referer=https://auth.my-domain.com/auth/
            header=Host=auth.my-domain.com:8443
            header=X-Forwarded-Host=auth.my-domain.com
            locale=[en_US]
            method=GET
          protocol=HTTP/1.1
       queryString=
        remoteAddr=/<REDACTED>
        remoteHost=<REDACTED>
            scheme=https
              host=auth.my-domain.com:8443
        serverPort=8443
          isSecure=true
--------------------------RESPONSE--------------------------
     contentLength=0
       contentType=null
            header=Connection=keep-alive
            header=Location=https://auth.my-domain.com:8443/auth/admin/master/console/
            header=Content-Length=0
            header=Date=Fri, 21 Jun 2019 07:05:28 GMT
            status=302
-----------------------------请求---------------------------
URI=/auth/admin/
characterEncoding=null
contentLength=-1
contentType=null
header=X-Real-IP=
header=Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
页眉=接受语言=en us
header=接受编码=br,gzip,deflate
header=用户代理=
header=连接=保持活动状态
header=X-Forwarded-Proto=https
标头=X-转发端口=8443
header=X-Forwarded-For=
header=Referer=https://auth.my-domain.com/auth/
header=Host=auth.my domain.com:8443
header=X-Forwarded-Host=auth.my-domain.com
语言环境=[en_US]
方法=获取
协议=HTTP/1.1
质询=
远程地址=/
远程主机=
scheme=https
host=auth.my domain.com:8443
服务器端口=8443
isSecure=true
--------------------------回应--------------------------
contentLength=0
contentType=null
header=连接=保持活动状态
标题=位置=https://auth.my-domain.com:8443/auth/admin/master/console/
标题=内容长度=0
页眉=日期=2019年6月21日星期五07:05:28 GMT
状态=302

如果我能让KeyClope只使用路径而不是端口来响应,或者它必须使用端口来响应,那就太好了。告诉它我希望它使用哪个端口。

hostname
SPI,它允许您为
KeyClope
设置主机名和端口,而不是从HTTP请求中检索它们。您可以将端口设置为默认端口(80/443),生成的URL将不会显示端口

# Replace `request` provider with `fixed`
/subsystem=keycloak-server/spi=hostname:write-attribute(name=default-provider,value=fixed)
# Set hostname and ports for http and https
/subsystem=keycloak-server/spi=hostname/provider=fixed:write-attribute(name=properties.hostname,value=example.org)
/subsystem=keycloak-server/spi=hostname/provider=fixed:write-attribute(name=properties.httpsPort,value=443)
/subsystem=keycloak-server/spi=hostname/provider=fixed:write-attribute(name=properties.httpPort,value=80)

这些值不是运行时可配置的,因此您必须在更改后重新启动KeyClope。

hostname
SPI,允许您为
KeyClope
设置主机名和端口,而不是从HTTP请求中检索它们。您可以将端口设置为默认端口(80/443),生成的URL将不会显示端口

# Replace `request` provider with `fixed`
/subsystem=keycloak-server/spi=hostname:write-attribute(name=default-provider,value=fixed)
# Set hostname and ports for http and https
/subsystem=keycloak-server/spi=hostname/provider=fixed:write-attribute(name=properties.hostname,value=example.org)
/subsystem=keycloak-server/spi=hostname/provider=fixed:write-attribute(name=properties.httpsPort,value=443)
/subsystem=keycloak-server/spi=hostname/provider=fixed:write-attribute(name=properties.httpPort,value=80)

这些值不是运行时可配置的,因此您必须在更改后重新启动KeyClope。

好的,更多信息,问题出在
header=Host=auth.my domain.com:8443
。如果有人知道如何让wildfly删除端口或使用
X-Forwarded-Host
,这将节省我阅读代码的时间!好的,更多信息,问题出在
header=Host=auth.my domain.com:8443
。如果有人知道如何让wildfly删除端口或使用
X-Forwarded-Host
,这将节省我阅读代码的时间!