需要信息:
我在Spring项目后面使用Keycloak (Docker版本)。
(该项目的客户端是React,客户端和后端之间的通信由REST服务提供。)
客户端是安全的,并使用"https“方案。
这是我的Spring配置:
keycloak:
auth-server-url: https://sso-ssoha.b9ad.pro-us-east-1.openshiftapps.com/auth
realm: master
resource: clientname
public-client: true
问题的根源:
当我单击来自客户端的链接时,它通常会调用Spring服务。但在此之前,它通过将这个路径sso/添加到当前的"https“url,但将方案更改为"http”,重定向到Keycloak的默认登录页面。
但是,将https重定向到http会产生如下问题:
Mixed Content: The page at 'https://www.helpful.army/contents/Problem' was loaded over HTTPS, but requested an insecure resource 'http://serviceha-helpfularmy.b9ad.pro-us-east-1.openshiftapps.com/sso/login'. This request has been blocked; the content must be served over HTTPS.
发布于 2022-07-25 14:50:59
在较新版本的keycloak中,您可以使用值proxy
配置passthrough
设置。对于docker,您希望通过环境变量KC_PROXY=passthrough
(keycloack配置文档)传递设置。
https://stackoverflow.com/questions/55044623
复制相似问题