Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

Neil Gee

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Redirect HTTP to HTTPS on Tomcat

April 19, 2013 8 Comments

You’ve bought your SSL secure certificate and successfully installed on Tomcat with the keytool but how do your redirect the entire site to go HTTPS and redirect any HTTP connection straight over to HTTPS.

You need to edit the 2 Tomcat configuration files; server.xml and web.xml and then when edited restart the tomcat service.

Open server.xml typically found in tomcat/conf and change:

Connector port="80?
 enableLookups="false"
 redirectPort="8443?

to

Connector port="80?
 enableLookups="false"
 redirectPort="443?

Then openweb.xml (same directory) and add this snippet before the closing tag of /web-app:

<security-constraint>
 <web-resource-collection>
 <web-resource-name>Protected Context</web-resource-name>
 <url-pattern>/*</url-pattern>
 </web-resource-collection>
 <!-- auth-constraint goes here if you requre authentication -->
 <user-data-constraint>
 <transport-guarantee>CONFIDENTIAL</transport-guarantee>
 </user-data-constraint>
 </security-constraint>

Restart Tomcat and all pages should redirect to https.

Cats: Open Source, WebRoot Tags: http, https, redirect, SSL, tomcat

The Ultimate Managed Hosting Platform

Subscribe

Coolest Guides on the Planet

Tags

3gs 10.6 apache backup baseband Bing boot clean urls Coolest Guy on the Planet cpanel css custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect remote rsa SEO shell ssh terminal unstoppables urls Yahoo
Load WooCommerce Stores in 249ms!
Beaver Builder Ultimate Addons

Donate a Beer to the Coolest Guides

Get Beaver Builder Now!
Load WordPress Sites in as fast as 37ms!

Copyright © 2021· Neil Gee - All Rights Reserved - Hosted by Runcloud

Copyright © 2021 · gee on Genesis Framework · WordPress · Log in