我们正在尝试使用keycloak对应用程序进行身份验证。两个应用程序都在nginx后面,nginx配置似乎很好(如下所示)
我们遇到的问题是我们指定的redirect_url类似于https://website.com/myapplication/auth,但keycloak会在https://auth.website.com/myapplication/auth重定向到自己的域
我们尝试调试此问题,但无法弄清楚可能是什么问题。任何指针都会受到赞赏。
nginx配置
server{
listen 443;
server_name auth.website.com;
... certificates
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $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-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:8080;
}
}
答案 0 :(得分:0)
通过将nginx配置更改为以下
来解决此问题server{
listen 443;
server_name auth.website.com;
... certificates
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_buffer_size 64k;
proxy_buffers 8 64k;
proxy_busy_buffers_size 64k;
proxy_pass http://127.0.0.1:9090;
}
}