Keycloak 23.06 on AKS and nginx ingress and exposed through Azure Application GW - Mixed content

59 Views Asked by At

I'm facing the following issue : enter image description here

Keycloak is deployed inside an Azure K8S cluster and with ingress nginx. Azure application gateway is exposing the keycloak urls by listening on 443 with an SSL cert.

Keycloak env vars (i tried different things but, no luck :():

env:
        - name: KEYCLOAK_ADMIN
          value: "admin"
        - name: KEYCLOAK_ADMIN_PASSWORD
          value: "admin"
        - name: KC_PROXY
          value: "edge"
        - name: KC_HOSTNAME #forcessl
          value: "ssopoc-keycloack.inter-invest.fr"
        - name: PROXY_ADDRESS_FORWARDING
          value : "true"

The nginx ingress configuration:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: keycloak-ingress
  namespace: keycloak
  annotations:
    kubernetes.io/ingress.class: nginx
    ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.org/server-snippets: |
      location / {
        proxy_set_header X-Forwarded-For $host;
        proxy_set_header X-Forwarded-Proto $scheme;
      }  
      proxy_set_header X-Forwarded-For $host;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection ‘upgrade’;
      proxy_set_header Host $host;
spec:
  ingressClassName: nginx
  rules:
  - host: "ssopoc-keycloack.domain.fr"
    http:
      paths:
        - pathType: Prefix
          path: "/"
          backend:
            service:
              name: keycloak-service
              port:
                number: 8080

I tried many configurations but still the same issue. If i bypass the application gateway proxy it's working, but when acessing the url through the application gateway, some links are pointing to http and not https ...so mixing content.

I would like to know if other people as me faced the same issue ?

Many thanks at all for your help !

0

There are 0 best solutions below