【发布时间】:2018-09-12 18:03:39
【问题描述】:
Keycloak 正在使用带有 nginx 配置的反向代理,以便在 ssl(https) 中可用。 现在我已经在 ubuntu 中部署了 .net 核心应用程序。 此应用程序位于 http 中,并使用 keycloak 作为 openid 连接进行身份验证。
但是,当应用程序使用 nginx 在 https 中托管时,keycloak 会显示无效的重定向 url 而不是登录页面。 Keycloak 登录 url 页面包含带有 http 而不是 https 的 redirect_uri 参数。请帮忙解决 在 nginx 的配置文件中完成反向代理的配置
server {
listen 443 ssl;
server_name abc.ctech.com;
ssl_certificate /etc/nginx/external/wildcard_ctech_com.pem;
ssl_certificate_key /etc/nginx/external/private.rsa;
location / {
proxy_http_version 1.1;
proxy_set_header Host abc.ctech.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://172.30.5.28:8001;
}
}
#Keycloak Service
server {
listen 443 ssl;
server_name keycloak.ctech.com;
ssl_certificate /etc/nginx/external/wildcard_ctech_com.pem;
ssl_certificate_key /etc/nginx/external/private.rsa;
location = / {
return 301 https://keycloak.ctech.com/auth;
}
location /auth {
proxy_pass http://172.30.5.28:8080/auth;
proxy_http_version 1.1;
proxy_set_header Host keycloak.ctech.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
【问题讨论】: