There exists a tomcat server (6..20) running one web application behind two web addresses, e.g. world wide web.foo and secure.foo
This really is set up within the server.xml as you host having a single alias:
<Host name="www.foo" appBase="webapps"> <Context docBase="foo" path=""></Context> <Alias>secure.foo</Alias> </Host>
Ideally we want any demands to secure.foo on port 80 to become instantly rerouted to make use of ssl. However, I'm able to only find instructions for redirecting in line with the path after the hostname, and so i could give a /* security constraint however this could affect both web addresses.
Does anybody determine if you can apply the redirection by blocking on hostname asked for?
(We have already got the ssl connector, certificate, etc. working ok).
I understand we're able to get it done by adhering an apache server before tomcat and handling the redirection there, but I am curious to understand if tomcat can perform this by itself.
Use "service components" to bundle fittings and engines (using the appropriate hosts). Within the non-encoded hosts you can put a html (meta redirect) or jsp (http header redirect) apply for the redirect.