Can tomcat perform ssl redirection by filtering host alias?
We have a tomcat server (6.0.20) running one web application behind two urls, e.g. www.foo and secure.foo
This is configured in the server.xml as one host with a single alias:
<Host name="www.foo" appBase="webapps">
<Context docBase="foo" path=""></Context>
<Alias>secure.foo</Alias>
</Host>
Ideally we'd like any requests to secure.foo on port 80 to be automatically redirected to use ssl. However, I can only find instructions for redirecting based on the path after the hostname, so I could add a /* security constraint but then this would apply to both urls.开发者_如何学C
Does anyone know if it's possible to apply the redirection by filtering on hostname requested?
(We've already got the ssl connector, certificate, etc. working ok).
I know we could do it by sticking an apache server in front of tomcat and handling the redirection there, but I'm curious to know if tomcat can do this on its own.
Thanks
Use "service components" to bundle connectors and engines (with the appropriate hosts). In the non-encrypted hosts you can place a html (meta redirect) or jsp (http header redirect) file for the redirect.
精彩评论