所需信息:
我在 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
Run Code Online (Sandbox Code Playgroud)
问题的根源:
当我点击客户端的链接时,它会正常调用 Spring 服务。但在此之前,它会重定向到 Keycloak 的默认登录页面,并将此路径sso/login添加到当前的“https”url,但将方案更改为“http”。
但是,从 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.
Run Code Online (Sandbox Code Playgroud)