Anyone have any idea?
A:
One possible approach might be to use mod_rewrite
I'm sure there's others.
cagcowboy
2009-02-10 08:40:37
+2
A:
The servlet container should automatically redirect the user to the HTTPS listener if you set the transport-guarantee
element to CONFIDENTIAL
or INTEGRAL
in your web.xml
, like so:
<security-constraint>
<web-resource-collection>
<url-pattern>*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
The url-pattern
element contents should match the path you wish to secure. So, for example, if you want to secure everything under /admin
, specify /admin/*
as your url-pattern
. This should exhibit the following behaviour:
http://www.example.org/admin/login
will redirect to
https://www.example.org/admin/login
For more information, check out the Servlet 2.5 specification (JSR 154).
David Grant
2009-02-10 09:14:54