Affects: 5.1.10
It took me half a day to figure out why my spring hateoas / ForwardedHeaderFilter setup did not work as intended.
It appeared that the HttpServletRequest used by ServletUriComponentsBuilder wasn't the wrapped one, which is caused by the fact that ForwardedHeaderFilter was executed AFTER RequestContextFilter.
You basically need to do this:
@Bean
public FilterRegistrationBean forwardedHeaderFilterRegistrationBean() {
FilterRegistrationBean<ForwardedHeaderFilter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(new ForwardedHeaderFilter());
registrationBean.addUrlPatterns("*");
registrationBean.setOrder(org.springframework.boot.web.servlet.filter.OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER - 1);
return registrationBean;
}
I didn't find any mention of this in the docs...
Affects: 5.1.10
It took me half a day to figure out why my spring hateoas /
ForwardedHeaderFiltersetup did not work as intended.It appeared that the
HttpServletRequestused byServletUriComponentsBuilderwasn't the wrapped one, which is caused by the fact thatForwardedHeaderFilterwas executed AFTERRequestContextFilter.You basically need to do this:
I didn't find any mention of this in the docs...