一个伪linux粉丝的blog

  1. 首页
  2. network
  3. 正文

keycloak stuck in loading admin ui

5 1 月, 2025 290点热度 0人点赞 0条评论

背景:

内网有一个服务是用keycloak来认证的,临时要修改一个设置,没想到访问 keycloak的nodeport 地址后,auth 页面正常,点击 admin console后,出现了无限的转圈圈,卡在了 "Loading the Admin UI"这里。

排查:

浏览器网络和console似乎看到这样的提示“Refused to frame 'http://keycloak-url/' because it violates the following Content Security Policy directive: "frame-src 'self'".”

换了访问环境也是这样,检查对应的服务日志,没看出异常,于是搜到了这里

https://stackoverflow.com/questions/73883728/keycloak-admin-console-loading-indefinitely

里面有1句,the value for KC_HOSTNAME should match that IP address。 KC_HOSTNAME 地址要匹配服务地址

 

还有一段,开启debug模式,检查下 KC_HOSTNAME 相关的输出

There's a related issue documenting this on their GitHub with specific instructions on how to debug this:
Start Keycloak with the --hostname-debug=true option.(Env var: KC_HOSTNAME_DEBUG.) Documentation link
Browse to this URL: KEYCLOAK_BASE_URL/realms/master/hostname-debug
You would see an HTML table with a set of [OK] and [Not OK] next to frontend, backend, and admin.
环境变量增加2个字段看看呗。

开启后,访问debug页面地址  ,结果3个failed

http://10.17.0.13:31422/auth/realms/master/hostname-debug

这就是卡loading 的原因,地址不一致。

想了一下,访问地址换成 集群ip 看看。 http://10.233.26.226/auth/realms/master/hostname-debug

有进步,除frontend 继续failed 外,其他backend和admin 都ok了

继续排查, 想了一下,把环境变量中的 KC_HOSTNAME 改成集群 ip 10.233.26.226 试试。 果然3个ok。

后来把 hostname 改成节点 10.17.0.13 , 也能3个 ok了。

 

直接访问 http://10.233.26.226/auth/admin/master/console/ 看看,果然正常了,使用集群 ip 绕行成功。

 

一些线索

里面有人提到这个参数已经废弃了

Update from 2024: KC_PROXY is deprecated, prefer
KC_PROXY_HEADERS=forwarded : keycloak.org/server/all-config#category-proxy
另一套环境:
直接去掉KC_PROXY=edge,改了这个参数为KC_PROXY_HEADERS=xforwarded 或forwarded  都行。
直接就能访问了,看来最主要还是 KC_PROXY 这个参数变化的锅  :smile:

一点背景

  • Frontend. Used for in-browser authentication flows, account console, etc.
  • Backend. Used for backend communication between a client (an application secured by Keycloak) and Keycloak itself. This might be over a local network, avoiding a reverse proxy.
  • Admin Console. A URL used for Admin Console. It is used for redirect URLs, loading resources (CSS, JS), etc.

相关文章:

  1. 基于Ubuntu Nginx Mongrel Mysql部署rails
  2. 谁是你在虚拟主机上的邻居呢?
  3. 国外虚拟主机购买指南top10对比
  4. 如何捕获扫描无线信号?
标签: KC_PROXY_HEADERS keycloak
最后更新:7 1 月, 2025

wanjie

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

This site uses Akismet to reduce spam. Learn how your comment data is processed.

归档
分类
  • network / 332篇
  • Uncategorized / 116篇
  • unix/linux / 121篇
  • 业界资讯 / 38篇
  • 公司杂事 / 11篇
  • 数码影像 / 12篇
  • 美剧 / 3篇
  • 美图共赏 / 21篇
  • 英语学习 / 3篇
标签聚合
泰国 debian openssl ldap k8s 虚拟主机 邮件归档 网站运营 浏览器 gitlab VPS d90 ssh wget Nginx docker nexus 天翼live dreamhost空间 deepseek kernel Google dreamhost squid jira kubectl postgres Google Voice Ubuntu google-chrome

COPYRIGHT © 2008-2025 wanjie.info. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang