I have a minimal spring boot web application running on external tomcat. I had to migrate from spring boot 1.x to 2.y. But after migration, Hateoas links were using the node address instead of using forwarded-header-*
sent from the proxy server.
So the general solution suggested was to add this following property in app.properties.
spring server.forward-headers-strategy=native
But this works only in embedded tomcat and not in external tomcat. Although setting this value to framework creates a ForwardHeaderFilter
bean and solves the problem, I wanted to understand why it doesn't work in external tomcat environment.
I have asked a similar question here to understand the differences between native
and framework
.
@SpringBootApplication
public class HibernateApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(HibernateApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(HibernateApplication.class);
}
}
It was working perfectly fine in Spring boot 1.5.10.RELEASE
. But stopped working in 2.4.6
. I'm not sure if I have to add any additional properties to external tomcat web application.