Keycloak behind a reverse proxy (WAF)

526 views
Skip to first unread message

Nikolas Iliopoulos

unread,
Aug 8, 2022, 5:27:38 AM8/8/22
to Keycloak User
Hi,

We have a Spring Boot application that we want to secure using Keycloak.

When we take a token from
http://{ip}:{port}/realms/{realm-name}/protocol/openid-connect/token
And we try to access the application it works

But when we take a token from
https://{name}/realms/{realm-name}/protocol/openid-connect/token
And we try to access the application we get 401 Unauthorized

In the application.properties we have given the url http://{ip}:{port}

docker-compose for keycloak
```
version: '3.9'

services:
  keycloak:
    container_name: keycloak
    restart: unless-stopped
    ports:
      - 7000:8080
    command:
      - start-dev
    environment:
      KEYCLOAK_ADMIN: admin
      KEYCLOAK_ADMIN_PASSWORD: password
      KC_PROXY: edge
```

Björn Pedersen

unread,
Aug 8, 2022, 9:29:11 AM8/8/22
to Keycloak User
Check  https://www.keycloak.org/server/reverseproxy, probably you need to configure the proxy to correctly set some headers.
Reply all
Reply to author
Forward
0 new messages