title: Spring server.forward-headers-strategy NATIVE vs FRAMEWORK
body: <p>I recently upgraded spring boot from 1.x to 2.y and was facing this issue where hateoas links were generated with <code>http</code> scheme instead of <code>https</code>.</p>
  <p>Later I discovered that with spring boot 2.2+, it is mandatory to use the following property</p>
  <pre><code>server.forward-headers-strategy=NATIVE
  </code></pre>
  <p>which can have one of <code>NATIVE</code> or <code>FRAMEWORK</code> or <code>NONE</code>.</p>
  <p><code>NONE</code> property is pretty straight forward and it totally disables use of forward headers.</p>
  <p>But there is no clear documentation on <code>NATIVE</code> vs <code>FRAMEWORK</code>. I've seen in many places it is mentioned that <code>NATIVE</code> works the best in most cases. But there is no explanation on what exactly happens behind the scenes when we use these properties.</p>
  <p>The <a href="https://github.com/spring-projects/spring-boot/blob/8b732a9c330c479d4ab1ff79d5842cbbc89b9515/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java#L1700-L1717" rel="noreferrer">documentation here</a> doesn't give enough information for me to choose between Native/Framework. All it says is who handles the forwarded headers for corresponding values. Servlet container? or Spring framework? but it brings back to square 1. Should I let container handle it? or the framework? when Should I prefer one over the other?</p>
  <p>I am using REST web application with external tomcat and <code>Hateoas</code> for generating the links.</p>
  <p>How do I decide whether to use  <code>NATIVE</code> or <code>FRAMEWORK</code> property? When should one be preferred over the other and why?</p>
  <p>My springboot version: <code>2.4.6</code></p>
  <p><strong>References I've already tried:</strong></p>
  <ul>
  <li><a href="https://github.com/spring-projects/spring-boot/issues/18667" rel="noreferrer">https://github.com/spring-projects/spring-boot/issues/18667</a></li>
  <li><a href="https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2-Release-Notes#deprecations-in-spring-boot-22" rel="noreferrer">https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2-Release-Notes#deprecations-in-spring-boot-22</a></li>
  <li><a href="https://docs.spring.io/spring-framework/docs/5.1.3.RELEASE/spring-framework-reference/web.html#filters-forwarded-headers" rel="noreferrer">https://docs.spring.io/spring-framework/docs/5.1.3.RELEASE/spring-framework-reference/web.html#filters-forwarded-headers</a></li>
  <li><a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#filters-forwarded-headers" rel="noreferrer">https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#filters-forwarded-headers</a></li>
  </ul>
  <p><strong>EDIT:</strong></p>
  <p>I tried both the solutions and <code>framework</code> works for me but not <code>native</code> in external tomcat environment. I created a new spring boot web application with embedded tomcat and both <code>native</code> and <code>framework</code> works.</p>