Modi
Modi

Reputation: 2355

Spring boot - Embeded Tomcat HTTP to HTTPS redirect

I'm using Java 7, Spring-Boot 1.1.7 and an ambeded Tomcat 7.

In the past, when I used a stand alone Tomcat, I used to add an http connector, that will redirect the requests to the HTTPS port :

<Connector port="8080" enableLookups="false"
           redirectPort="8443" />

How can I do it when I'm using an embeded Tomcat (and I dont have a server.xml file) ?

Upvotes: 2

Views: 6767

Answers (1)

Dave Syer
Dave Syer

Reputation: 58094

You can add a Connector or configure the existing one with its Java API (e.g. see http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#howto-enable-multiple-connectors-in-tomcat). The Connector has a setRedirectPort() (it's mapped directly by the XML <Connector/> element).

Upvotes: 2

Related Questions