Can tomcat perform ssl redirection by filtering host alias?
- by Stephen
Hi,
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.
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