作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
目标 :当 nginx 入口具有事件重写目标功能时,Keycloak 网守部署。
Ingress 根据以下内容重写目标:
rewrite.bar.com/something/
重写为 rewrite.bar.com/
rewrite.bar.com/something/new
重写为 rewrite.bar.com/new
X-Forwarded-Prefix: /something
#deployment.yaml:
...
- name: keycloak-gatekeeper
image: quay.io/keycloak/keycloak-gatekeeper:9.0.2
imagePullPolicy: IfNotPresent
args:
- --listen=0.0.0.0:3000
- --discovery-url=https://auth.server.com/auth/realms/realm
- --client-id={client_id}
- --client-secret={client_secret}
- --redirection-url=https://rewrite.bar.com/something/
- --upstream-url=http://127.0.0.1:8080
- --skip-upstream-tls-verify=false
- --skip-openid-provider-tls-verify=false
- --enable-default-deny=true
https://rewrite.bar.com/oauth/authorize?state=00191...
但端点在
https://rewrite.bar.com/something/oauth/authorize
.网守忽略 X-Forwarded-Prefix header 。通过添加
something/
在浏览器中手动更正路径时到路径,一切正常。正确重定向到身份验证服务器,回调也有效。
...
- --redirection-url=https://rewrite.bar.com/something/
- --base-uri=/something
...
https://rewrite.bar.com/something/oauth/authorize
由入口重写为
https://rewrite.bar.com/oauth/authorize它与网守 (
something/oauth/authorize
) 中不 protected 授权端点不匹配。它导致不断的重定向。
/something
重定向请求但不期望它(代理基网址)?
最佳答案
您可以使用代理重定向注释来完成此操作:https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#proxy-redirect
它会将位置标题更改为您想要的。
nginx.ingress.kubernetes.io/proxy-redirect-from: /oauth
nginx.ingress.kubernetes.io/proxy-redirect-to: /something/oauth
关于keycloak-gatekeeper - nginx 入口反向代理背后的 Keycloak 门卫,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61137555/
我正在寻找匹配 /(?=\W)(gimme)(?=\W)/gi 或类似的东西。 \W 应该是零宽度字符来包围我的实际匹配项。 也许有一些背景。我想用添加的文字填充替换某些单词(总是 \w+),但前提是
如何在不使用 Intent 连接到 VPN 服务的情况下以编程方式检测流量是否正在通过 VPN。有系统调用吗? 最佳答案 这个有效: private boolean checkVPN() {
我是一名优秀的程序员,十分优秀!