I deployed a Spring Boot Application on EB using a docker container. It works well but in some parts of my code I've something like this:
ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
to get the current url of the application. In the local machine it works fine but on EB (using classing load balancer) - that uses https protocol - that line of code return http instead of https.
I've already added this configuration in my project:
@Bean
FilterRegistrationBean<ForwardedHeaderFilter> forwardedHeaderFilter() {
FilterRegistrationBean<ForwardedHeaderFilter> bean = new FilterRegistrationBean<>();
bean.setFilter(new ForwardedHeaderFilter());
return bean;
}
Do you have any hint to follow to fix the problem?
CodePudding user response:
