3
目前我正在使用tomcat 6和spring-security 3.0.3.RELEASE没有Apache。有没有什么办法可以在spring-security的某些页面上强制https?
我可以强制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="https://stackoverflow.com/users/new" access="permitAll" requires-channel="https" />
<intercept-url pattern="https://stackoverflow.com/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链接 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.
Cookies是允许的,所以我认为这不是问题。当我尝试访问上述链接时,我在Chrome中遇到了类似的错误。
在我的配置端口8085是非SSL端口。 SSL在端口8443上配置,并且工作正常。
我希望对某些页面的所有访问尝试都重定向到https。
任何意见将不胜感激。
最好的问候, Tiho
这看起来像是可能的解决方案。我会在今天晚上测试它,并告诉你它是否适合我。 无论如何感谢您的帮助。 – Tiho 2011-03-29 09:48:59
这绝对有效。非常感谢。问候 – Tiho 2011-03-29 16:36:21