🔧(project) proxy Keycloak with nginx
Backend and Frontend send requests to Keycloak through Nginx. Thus, all requests from frontend and backend shared a same host when received by Keycloak. Otherwise, the flow is initiated from http://localhost:8080. When the Backend calls token endpoint from Keycloak container at http://keycloak:8080, the JWT token issuer and sender are mismatching.
This commit is contained in:
committed by
aleb_the_flash
parent
699854e76b
commit
927d0e5a22
@@ -93,12 +93,14 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8082:8082"
|
- "8082:8082"
|
||||||
- "8088:8088"
|
- "8088:8088"
|
||||||
|
- "8083:8083"
|
||||||
volumes:
|
volumes:
|
||||||
- ./docker/files/etc/nginx/conf.d:/etc/nginx/conf.d:ro
|
- ./docker/files/etc/nginx/conf.d:/etc/nginx/conf.d:ro
|
||||||
- ./src/frontend/apps/desk/out:/home/desk
|
- ./src/frontend/apps/desk/out:/home/desk
|
||||||
- ./data/media:/data/media:ro
|
- ./data/media:/data/media:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
- app
|
- app
|
||||||
|
- keycloak
|
||||||
|
|
||||||
dockerize:
|
dockerize:
|
||||||
image: jwilder/dockerize
|
image: jwilder/dockerize
|
||||||
@@ -152,6 +154,11 @@ services:
|
|||||||
- start-dev
|
- start-dev
|
||||||
- --features=preview
|
- --features=preview
|
||||||
- --import-realm
|
- --import-realm
|
||||||
|
- --proxy=edge
|
||||||
|
- --hostname-url=http://localhost:8083
|
||||||
|
- --hostname-admin-url=http://localhost:8083/
|
||||||
|
- --hostname-strict=false
|
||||||
|
- --hostname-strict-https=false
|
||||||
environment:
|
environment:
|
||||||
KEYCLOAK_ADMIN: admin
|
KEYCLOAK_ADMIN: admin
|
||||||
KEYCLOAK_ADMIN_PASSWORD: admin
|
KEYCLOAK_ADMIN_PASSWORD: admin
|
||||||
@@ -161,6 +168,7 @@ services:
|
|||||||
KC_DB_PASSWORD: pass
|
KC_DB_PASSWORD: pass
|
||||||
KC_DB_USERNAME: people
|
KC_DB_USERNAME: people
|
||||||
KC_DB_SCHEMA: public
|
KC_DB_SCHEMA: public
|
||||||
|
PROXY_ADDRESS_FORWARDING: 'true'
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -32,3 +32,17 @@ server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 8083;
|
||||||
|
server_name localhost;
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://keycloak:8080;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user