keycloak with nginx ingress "rewrite-target"

649 views
Skip to first unread message

Baitanik Talukder

unread,
Nov 3, 2022, 12:47:07 AM11/3/22
to Keycloak User
Hello ,
I have following ingress for keycloak service 
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
  name: keycloak
spec:
  ingressClassName: nginx
  rules:
  - host: keycloak.dev.com
    http:
      paths:
      - backend:
          service:
            name: keycloak-service
            port:
              number: 8080
        path: /cusompath/(.*)
        pathType: ImplementationSpecific

the admin landing page is opening at  http://keycloak.dev.com/cusompath/auth ,
but when i click on the "Administration console" for login, then keycloak service is redirecting to https://keycloak.dev.com/auth/admin/ and as for the /auth prefix we dont have ingress rule so it is getting 404 . 

we our cluster we can not use /auth prefix as in production it is a shared environment, already some ingress rule will be present with /auth.. 

how to override conftext path prefix from "/auth" to "/cusomauth/auth" OR "/customauth" for all keycloak service calls ?
could someone please help here ? 

Thanks , 
Baitanik


Björn Pedersen

unread,
Nov 3, 2022, 3:07:13 AM11/3/22
to Keycloak User


If you are  using a current keycloak version (>=17) then there is an option to set the prefix path (and no need for  rewrites).


Reply all
Reply to author
Forward
0 new messages