1

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) ?

Modi
  • 2,200
  • 4
  • 23
  • 37

1 Answers1

2

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).

Dave Syer
  • 56,583
  • 10
  • 155
  • 143
  • Adding a connecter and setting the HTTP port was not enough, I had to use @Andy Wilkinson's .answer: http://stackoverflow.com/questions/26655875/spring-boot-redirect-http-to-https – Modi Dec 07 '14 at 12:15
  • Could you give an example please – maxiplay Jul 04 '16 at 18:48