I have a docker running with two containers.
The first container has wildfly and nginx as reverse proxy and the second one has keycloak.
The keycloak container name is 'sso' which can be resolved to container's ip address.
In keycloak i made a realm with name 'sso'.
The configuration for authentication works, but when keycloak tries to redirect the user so the user can enter the credentials , it redirects the user to 'sso/auth/realm/sso/output-omitted' but sso doesn't exit outside of docker.
How i can force keycloak to redirect to user's requested host address ?
Here is the nginx.conf
http {
upstream keycloak_server {
server sso:8080;
}
upstream wildfly_server {
server localhost:8080;
}
server {
listen 80;
location / {
proxy_pass http://wildfly_server;
}
location /auth/ {
proxy_pass http://keycloak_server;
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_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
Here is the keycloak.json
{
"realm-public-key": "",
"realm": "sso",
"auth-server-url": "http://sso/auth",
"ssl-required": "none",
"resource": "sso",
"credentials": {
"secret": ""
},
"use-resource-role-mappings": true,
"enable-cors": true,
"public-client": true
}