Nginx就像是几个网站的代理。在其中一个站点上,重定向到SSO登录并返回URL显示的原始域而不是代理域。
conf:
location /demo/web1 {
proxy_pass https://website1.net/web1/index.html;
proxy_redirect default;
proxy_redirect https://website1.net/web1/index.html https://proxywebsites.com/demo/web1;
}
location /demo/monitor {
proxy_pass https://monitorwebsite.net/monitor;
proxy_redirect default;
proxy_redirect https://monitorwebsite.net/monitor https://proxywebsites.com/demo/monitor;
}
location /Home/SignIn {
proxy_pass https://thirdWebsite.net/Home/SignIn;
proxy_redirect default;
proxy_redirect https://thirdWebsite.net/Home/SignIn https://proxywebsites.com/Home/SignIn;
}
它是如何工作的?当您加载/ demo / monitor时,您将被重定向到/ Home / SignIn,从那里您将被重定向到SSO网站,例如http://sso.com?id=blalba。问题是它重定向为" returnUrl"参数和在该参数中返回url不是代理,而是origin。例如: http://sso.com?id=blalba&ReturnUrl=monitorwebsite.net/monitor,应为http://sso.com?id=blalba&ReturnUrl=proxywebsites.com/demo/monitor