title: Configuring embedded Jetty 9 for X-FORWARDED-PROTO with Spring Boot
body: <p>I am running a Spring Boot application in AWS. The application is running behind an Elastic Load Balancer (ELB). The ELB is configured to use <code>https</code> (port <code>443</code>) to the outside world, but passes through <code>http</code> (port <code>8080</code>) to the application. The ELB is configured to pass through the <code>x-forwarded-proto</code> header. I am using Jetty <code>9.0.0.M0</code>, with Spring Boot <code>1.1.5 RELEASE</code>.</p>
  
  <p>I appear to be getting incorrect redirects sent back from the application via the ELB where the redirect responses are coming back as <code>http</code>, rather than <code>https</code>. Now, I read <a href="http://www.gossamer-threads.com/lists/apache/users/407272" rel="noreferrer">here</a> that I should set the "forwarded" header to <code>true</code> using:</p>
  
  <pre><code>&lt;Set name="forwarded"&gt;true&lt;/Set&gt;
  </code></pre>
  
  <p>I can't see how to do this with the embedded version of Jetty in Spring Boot because there is no XML configuration file as part of my source.</p>
  
  <p>I have looked at the <code>EmbeddedServletContainerCustomizer</code> infrastructure but I still can't get the right incantation to get this setup to work.</p>
  
  <p>The application is built and tested outside of the AWS <code>https</code> environment, so the application needs to transparently work with <code>http</code> too. Directly hitting the application endpoints without going through the ELB works. It's just that the ELB to application route that's not working.</p>
  
  <p>Any ideas? </p>