Apache ProxyPreserveHost 配置

在应用SAML的时候,HTTP Request的HOST URL是一个非常重要的参数,用于鉴定当前请求是不是和SAML的metadata一致。如果不一致的话,认证是无法通过的。

在HA环境下,Apache作为反向代理,后面会配置多个Tomcat,并且Tomcat的地址一般都是使用的内网IP,如此Tomcat在获取请求的时候就会发现当前请求的request host和metadata里的host不一致,因为metadata肯定需要配置成reverse proxy的URL。

解决的方法就是在Apache中启用ProxyPreserveHost参数。
ProxyPreserveHost on
ProxyPass / shib.example.edu:8443/
ProxyPassReverse / shib.example.edu:8443/
[quote]
Enabling the Apache ProxyPreserveHost directive
The ProxyPreserveHost directive is used to instruct Apache mod_proxy, when acting as a reverse proxy, to preserve and retain the original Host: header from the client browser when constructing the proxied request to send to the target server.

The default setting for this configuration directive is Off, indicating to not preserve the Host: header and instead generate a Host: header based on the target server's hostname.

Because this is often not what is wanted, you should add the ProxyPreserveHost On directive to the Apache HTTPD configuration, either in httpd.conf or related/equivalent configuration files.[/quote]

另外一个链接:
[url]http://shibboleth.1660669.n2.nabble.com/IDP-Reverse-Proxy-td7580833.html[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值