title: How to redirect automatically to https with Spring Boot
body: <p>How I can easily configure the embedded tomcat server to redirect all http traffic to https? I have Spring Boot running on an ec2 instance that is behind an elastic load balancer. I have configured the ELB to handle ssl for me (which is awesome) and it sets the X-FORWARDED-PROTO header to "https". I want to detect when that isn't set, and redirect the user to force them to use https if they aren't already.</p>
  
  <p>So far, I have tried adding the following to my application.properties file with no luck:</p>
  
  <pre><code>server.tomcat.protocol-header=x-forwarded-proto
  security.require-ssl=true
  </code></pre>