8000 Keycloak admin console not loading with the docker container being behind reverse proxy · Issue #41304 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Keycloak admin console not loading with the docker container being behind reverse proxy #41304

Closed

Description

@nmrsmn

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

admin/ui

Describe the bug

Whenever I have booted up keycloak using docker compose up -d keycloak and I try to navigate to the administration console from within my own home network the console won't load (keeps loading forever). When I try to open the same url using my phones, not connected to the home network, the console loads just fine. So far keycloak is working perfectly from outside my network. I just don't get it to work properly from my home network, which I really want get working as I use keycloak as the auth server for my app.

My setup:
In my home I've installed a raspberry pi 4 with installed docker. I've created several containers including nginx and keycloak.
I've setup nginx to work as a reverse proxy for a couple of containers and I've used the following setup as my nginx keycloak setup:

# Keycloak
upstream keycloak {
	server 10.5.0.30:8080;
	keepalive 128;
}

server {
	listen 443 ssl;
	listen [::]:443 ssl;
	http2 on;

	server_name keycloak.some.domain;
	server_tokens off;

	ssl_certificate /etc/nginx/ssl/live/keycloak.some.domain/fullchain.pem;
	ssl_certificate_key /etc/nginx/ssl/live/keycloak.some.domain/privkey.pem;
	include /etc/nginx/ssl/options-ssl-nginx.conf;
	ssl_dhparam /etc/nginx/ssl/ssl-dhparams.pem;

	location ^~ /.well-known/acme-challenge/ {
		default_type "text/plain";
		alias /var/www/certbot/.well-known/acme-challenge/;
	}

	location / {
		proxy_pass http://keycloak;
		# proxy_http_version 1.1;

		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_protocol_addr;
		proxy_set_header X-Forwarded-Host $host;
		proxy_set_header X-Forwarded-Server $host;
		proxy_set_header X-Forwarded-Port $server_port;
		proxy_set_header X-Forwarded-Proto $scheme;
		
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		
		# proxy_redirect off;
		# proxy_buffering off;
		proxy_buffer_size          128k;
		proxy_buffers              4 256k;
		proxy_busy_buffers_size    256k;

		proxy_send_timeout 86400s;
		proxy_read_timeout 86400s;
    }
}

The docker compose configuration I'm using:

  keycloak:
    image: keycloak/keycloak:26.3.1
    hostname: keycloak
    restart: unless-stopped
    ports:
      - 8080:8080
    entrypoint: ["/opt/keycloak/bin/kc.sh", "start-dev"]
    volumes:
      - /opt/keycloak/data:/var/lib/postgresql/data/:rw
      - /opt/postgres/init:/docker-entrypoint-initdb.d:r
    environment:
      KC_HOSTNAME: https://keycloak.some.domain/
      KC_HOSTNAME_BACKCHANNEL_DYNAMIC: true
      KC_HOSTNAME_DEBUG: true
      KC_HOSTNAME_STRICT: false

      # KC_HTTP_PORT: 8080
      KC_HTTP_ENABLED: true
      # KC_HTTPS_PORT: 8443

      KC_PROXY_HEADERS: xforwarded
      KC_PROXY_ADDRESS_FORWARDING: true

      KC_DB: postgres
      KC_DB_URL_HOST: postgres
      KC_DB_URL_DATABASE: ${KEYCLOAK_DB_NAME}
      KC_DB_USERNAME: ${SMARTHOME_DB_USER}
      KC_DB_PASSWORD: ${SMARTHOME_DB_PASSWORD}
      KC_DB_SCHEMA: public

      KC_LOG_LEVEL: trace
      # KC_LOG_LEVEL_ORG_KEYCLOAK: trace
      
      KC_HEALTH_ENABLED: true
      KC_METRICS_ENABLED: true
      
      KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN_USER}
      KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASS}
    healthcheck:
      test: timeout 10s bash -c ':> /dev/tcp/127.0.0.1/8443' || exit 1
      interval: 10s
      timeout: 5s
      retries: 3
      start_period: 90s
    depends_on:
      postgres:
        condition: service_healthy
    networks:
      network:
        ipv4_address: 10.5.0.30

If I open up the hostname-debug page from within my network it looks like the image below. If I open it up using my phone (not connected to the home network) it says Frontend, Backend and Admin OK...

Image

What am I doing wrong?

Version

26.3.1

Regression

  • The issue is a regression

Expected behavior

Keycloak to be usable from within and from outside my home network

Actual behavior

Keycloak isn't usable from within my home network

How to Reproduce?

  • Use the above docker-compose.yml to configure services
  • Use the above NGINX configuration
  • Run docker-compose up
  • Now go to https://keycloak.some.domain

Anything else?

No response

Activity

  1. added
    kind/bug
    on Jul 21, 2025
  2. added
    area/admin/ui
    on Jul 21, 2025
  3. locked and limited conversation to collaborators on Jul 21, 2025
  4. converted this issue into a discussion #41305 on Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/admin/uikind/bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0