-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Closed
Copy link
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: documentationA documentation taskA documentation task
Milestone
Description
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...
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: documentationA documentation taskA documentation task