【发布时间】:2011-07-24 16:50:33
【问题描述】:
目前我正在使用没有 apache 的 tomcat 6 和 spring-security 3.0.3.RELEASE。
我可以强制 https 登录页面,它工作得很好。
下一个配置用于阻止http访问某些页面。
<http use-expressions="true">
<intercept-url pattern="/" access="permitAll" />
<intercept-url pattern="/login" access="permitAll" requires-channel="https" />
<intercept-url pattern="/spring_security_login" access="permitAll" requires-channel="https" />
<intercept-url pattern="/users/new" access="permitAll" requires-channel="https" />
<intercept-url pattern="/users/authorize/*" access="isAuthenticated()" />
<!--<form-login /> -->
<form-login login-page="/login" />
<logout />
<remember-me />
<!--
Uncomment to enable X509 client authentication support <x509 />
-->
<!-- Uncomment to limit the number of sessions a user can have -->
<session-management>
<concurrency-control max-sessions="10000"
error-if-maximum-exceeded="true" />
</session-management>
</http>
但如果我尝试通过非 https 链接访问,例如,/buyers/new
http://localhost:8085/path/buyers/new我得到下一个错误:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
* This problem can sometimes be caused by disabling or refusing to accept
cookies.
Cookie 是允许的,所以我认为这不是问题。当我尝试访问上述链接时,我在 Chrome 中遇到了类似的错误。
在我的配置中,8085 端口是非 ssl 端口。 SSL 配置在 8443 端口,运行良好。
我希望对某些页面的所有访问尝试都重定向到 https。
我们将不胜感激任何建议。
最好的问候, 蒂霍
【问题讨论】: