2010-02-09 79 views
9

我们在我们的系统中使用弹簧安全,我们的服务器使用https方案。https在default-target-url弹簧安全

但是,该应用程序运行在http不是https上,所以服务器,即Apache, 是https处理程序。而应用程序在防火墙后面的http上运行。

工作代码:

<form-login login-page="/Login.html"  
authentication-failure-url="https://www.ourapp.com/FailureLogin.jsp" 
always-use-default-target="false" 
default-target-url="https://www.ourapp.com/SuccessLogin.jsp"/> 
<form-login login-page="/Login.html" 
authentication-failure-url="https://www.ourapp.com/FailureLogin.jsp" 
always-use-default-target="false" 
default-target-url="https://www.ourapp.com/SuccessLogin.jsp"/> 

不工作代码:

<form-login login-page="/Login.html"  
authentication-failure-url="/FailureLogin.jsp" 
always-use-default-target="false" 
default-target-url="/SuccessLogin.jsp"/> 
<form-login login-page="/Login.html" 
authentication-failure-url="/FailureLogin.jsp" 
always-use-default-target="false" 
default-target-url="/SuccessLogin.jsp"/> 

有什么办法说: 重定向到URL与/SuccessLogin.jsp结束,但使用https协议?

作为参考,问题是交叉发布@Code ranch PS:我可以TargetUrlResolver帮我在配置?

回答

6

使用requires-channel="https"

<http> 
    <intercept-url pattern="/**" requires-channel="https" /> 
</http> 

如果使用非标准端口提供port-mappings

<http> 
    <intercept-url pattern="/**" requires-channel="https" /> 
    <port-mappings> 
    <port-mapping http="80" https="443" /> 
    <port-mapping http="9080" https="9443" /> 
    <port-mappings> 
</http> 
+0

不知道怎么这会有所帮助。如果apache终止SSL,那么应用程序将*总是*接收http上的请求,而不是https。不要添加require-channel =“https”'会导致重定向循环? – Qwerky 2012-04-05 11:02:26