InMotion Hosting Support Center

Apache Tomcat 8.5 HTTP (80) to HTTPS (443) Redirect HOW-TO?


jowens1914
Asked:
2017-04-07 8:07 pm EST

Hits: 5,694
In a standalone Apache Tomcat (8.5.x) HTTP Server, how can configure it so if a user types www.domain.com, they will be automatically forwarded to https://www.domain.com.

The 2 step method of including the following in your WEB-INF/web.xml before the closing </web-app> tag
<security-constraint>
<web-resource-collection>
<web-resource-name>HTTPSOnly</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>

and setting the [Tomcat_base]/conf/server.xml connector settings:

<Connector URIEncoding="utf-8" connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort="443"/>
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="[keystorelocation]" type="RSA" />
</SSLHostConfig>
</Connector>

has not worked? Any direction would be greatly appreciated.
Additional details: I'm using Spring 4 MVC as well (don't think it matters however :-) )

You must login before you can ask a follow up question.

You must login before you can submit an answer.

OTHER ANSWERS

0

scott
Staff
43,761 Points
2017-04-10 9:31 am EST
Hello jowens1914,

Thank you for your question on configuring Apache TomCat to redirect from port 80 to 443.

Unfortunately, our normal support team is not able to support Apache TomCat questions. It is not part of our normal setup. If you are one of our customers, you can likely get our Manged Hosting Team to take a look. They work with more configurations that are not our default. Their services do have a fee, however.

Kindest Regards,
Scott M

You must login before you can post a comment about this answer.

Like this Question?

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

Need more Help?

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!