"Page error" when using keycloak "/auth"

Hello

I am trying to set up keycloak for a student project. I am using docker in order to run it with my api and postgre database. My plan is to use keycloak to manage accounts on my website and to allow connetion with oauth. Right now my api isn’t working, and i would like to test it straight from the auth page to better understand why i get a “page not found” error.

I do not understand why i do not have access to this page like in the tutorials:

I only get a message error “page not found” on http://localhost:8080/auth/
Here is my docker-compose in case this helps:

version: "3.9"

services:
  api:
    build: .
    volumes:
      - ./app:/app
    command: ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000", "--reload"]
    ports:
      - "5000:5000"
    env_file:
      - .env
    depends_on:
      postgres:
        condition: service_healthy
    networks:
      - network_sso

  keycloak:
    image: quay.io/keycloak/keycloak:22.0
    command: start-dev
    env_file:
      - .env
    ports:
      - "8080:8080"
    volumes:
      - keycloak_data:/opt/jboss/keycloak/standalone/data
    depends_on:
      postgres:
        condition: service_healthy
    networks:
      - network_sso

  postgres:
    image: postgres:10
    env_file:
      - .env
    healthcheck:
      test: "exit 0"
    ports:
      - "5432:5432"
    networks:
      - network_sso
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:
  keycloak_data:

networks:
  network_sso:
    driver: bridge

And my .env file is :

# Postgres
POSTGRES_DB=db_name
POSTGRES_USER=user_name
POSTGRES_PASSWORD=password

# KeyCloak

KC_DB= postgres
KC_DB_URL_HOST=postgres
KC_DB_URL_DATABASE=db_name
KC_DB_PASSWORD=password
KC_DB_USERNAME=user_name
KC_DB_SCHEMA=public
KEYCLOAK_ADMIN=admin
KEYCLOAK_ADMIN_PASSWORD=admin

Thanks for helping !

Try to use the URL without /auth.

This won’t work, the target path is no more available, it’s from the legacy container!
Additionally, why do you want to map this volume? What do you expect from it?

Thanks for your quick answer.

When i try to launch on my web (localhost:8080) It automatically change url to /auth (localhost:8080/auth). This is why i don’t understand why i am redirected on legacy content.

I wanted to map to map the volume to keep data each time i restart the container. Do i only need keep what is stored in my postgre ?
Thanks

Most probably because your browser still has anything cached. Try to clear/disable your browser cache.
Or, set the http-relative-path variable to /auth (see docs for details).

Data is stored only in the database!

1 Like

After clearning my cache i can now access the page. Thank you !