I have a single war cuba application deployed to Tomcat 8. The server is already SSL-enabled and configured. I want to force all access to my application to run over HTTPS. I tried adding this to my modules/web/WEB-INF/web.xml file:
Thanks. The server is already SSL enabled. That hasn’t been the issue. I was just trying to figure out how to make sure that my webapp is ONLY accessed via SSL. It turns out that, since I had this set up as a single war application, I had to make my changes in the single-war-web.xml file and not the web.xml file.
I’m still having some trouble with port mapping, but that’s because I’m behind a firewall and mapping the standard ports to internal ports on an internal server. The Tomcat SSL redirect is using the internal port, but that’s not actually visible to the browser. I have to figure out how to get around that next.
I’m pleased to report that a small configuration change to my Tomcat server got this working. I had my redirectPort set to the local Tomcat port (8443). I changed it to the external SSL Port (443) and now the automatic redirect to SSL is working properly for my app.