Repository navigation
Keycloak behind NGINX Ingress (Kubernetes, AWS) causes mixed content and CSP frame-ancestors 'none' error #43866
Replies: 3 comments 4 replies
Is no longer a valid option in KC 26+
Keycloak 26.x releases have varying issues with supporting this case because it is considered an insecure context and secure cookies are not allowed. You should try your scenario with 26.4, but keep in mind this is effective a dev setup and not expected to be used in production.
I wouldn't expect Keycloak to be issuing a redirect from HTTP to HTTPS as it does not appear you have enabled HTTPS nor are configuring a hostname that would force its usage - is that redirect happening at the browser or proxy level? |
|
It seems that the redirect might be happening in the browser, not directly from Keycloak — could that be the case? Looking at the response headers, I see an HTTP 308 Permanent Redirect, which appears to be coming from the Ingress Controller, not from Keycloak itself. Browser/Curl log excerpt: This might suggest that the HTTPS redirect is being enforced by the Ingress Controller configuration — maybe through an http-snippet, annotation, or some global rewrite rule? What’s interesting is that, in a local kind cluster using a default NGINX Ingress Controller, I was able to access Keycloak over plain without any issues using a local DNS entry. However, in my EKS environment, the same setup always results in this redirect (HTTP 308 → HTTPS). Could there be some custom configuration in the EKS ingress controller enforcing this behavior? |
|
Update / Resolution: The issue was resolved by deploying a new NGINX Ingress Controller configured with an AWS NLB (Network Load Balancer) without TLS termination. Instead of terminating TLS at the load balancer, I created a Kubernetes TLS Secret containing the certificate and key, and configured it directly in the Ingress resource of the Keycloak application. With this setup, HTTPS communication is now established end-to-end, and Keycloak correctly handles the redirect_uri and secure connections. |
Uh oh!
There was an error while loading. Please reload this page.
Context
I’m running Keycloak (Quarkus distribution) inside Kubernetes on AWS, exposed through an NGINX Ingress Controller.
The Ingress is associated with a Route53 DNS record pointing to the AWS Load Balancer.
I’m currently trying to make Keycloak fully accessible via HTTP only (no TLS termination at Ingress level), since HTTPS termination will be handled later in a different layer.
Configuration:
🔹 ConfigMap (Keycloak environment variables)
🔹 Ingress (HTTP only)
Observed behavior
When accessing the Keycloak admin console via HTTP, the page shows:
And in the browser console:
When testing HTTPS (through the same Load Balancer with TLS enabled), the browser reports mixed content errors:
And Keycloak container logs show:
What has been tried
Tested multiple combinations:
KC_HTTP_ENABLED:true/falseKC_HOSTNAME_STRICT:true/falseKC_PROXY:edge/passthroughKC_PROXY_HEADERS:xforwardedPROXY_ADDRESS_FORWARDINGIngress annotations tested (added/removed):
nginx.ingress.kubernetes.io/force-ssl-redirectnginx.ingress.kubernetes.io/backend-protocolnginx.ingress.kubernetes.io/configuration-snippetTLS / HTTP termination tested:
Observed behavior:
frame-ancestors 'none' blockingExpected behavior:
Keycloak admin console should load correctly over HTTP only, without redirect loops or mixed-content issues, when using:
Question:
Environment:
All reactions