I am trying to redirect the calls from http to https so:
In my server.xml I have two host:
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true">
...
</Host>
<Host name="other.name" appBase="/srv/webapp"
unpackWARs="true" autoDeploy="true">
...
</Host>
And I added on /etc/tomcat7/web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Context</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
So all request that are going to the localhost host are being redirect to https, however the requests that are going to other.name are not being redirect.
What I want is only the request that are going to other.name be redirect to https, how can I do that?
I tried to put
<url-pattern>other.name/*</url-pattern>
but didn't work. Any suggestion?
I removed the
<security-constraint>
from/etc/tomcat7/web.xml
and added to theWEB-INF/web.xml
of my web application.