-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Support for X-Forwarded-For and Forwarded for="..." #23260
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I am trying not to make separate issue, so please look, if this is same problem: spring-projects/spring-security#7081 |
@luvarqpp, the Related to this, it does look like in Spring Boot 2.2 you'll be able to choose where you get your forwarded header (server or Spring Framework). |
@larsgrefer can you clarify what handling you would expect to see? Overrides to |
I'd expect overrides to We've migrated our application from Tomcat's |
@rstoyanchev Thanks for clarification, but setting server.use-forward-headers to true does not help making simple login project to work correctly. Still first redirect does have wrong Location header. I have my experiment based on spring security example called hello world. PS: I have made given project to work, when Forwarded header is in use (instead of X-Forwarded-* family). Does tomcat require standardized header for forwarding? |
Thanks for the comment but this isn't the place to ask about Tomcat. |
Nice ! this filter saved me |
Is there a general idea how to handle the presence of both Forwarded and X-Forwarded- headers at the same time? When using spring application behind a fabio proxy this problem occurs. The headers that fabio sets are: Edited: created own issue #23819 |
@hlang You must register an instance of the @Bean
public FilterRegistrationBean<ForwardedHeaderFilter> forwardedHeaderFilter() {
final var bean = new FilterRegistrationBean<ForwardedHeaderFilter>();
bean.setFilter(new ForwardedHeaderFilter());
bean.setOrder(Ordered.HIGHEST_PRECEDENCE + 10);
return bean;
} Note that the |
@juanmbellini I use the |
@hlang this has nothing to do with the issue under which you're commenting. That creates noise for anyone interested in this ticket now or in the future. Please, create a separate issue. |
rather than Spring ForwardedHeaderFilter due to bug spring-projects/spring-framework#23260
This is superseded by #23582. |
See spring-projectsgh-34654, spring-projectsgh-23260 Signed-off-by: Mengqi Xu <2663479778@qq.com>
The
ForwardedHeaderFilter
seems to ignore theX-Forwarded-For
header and it'sForwarded
complement: https://tools.ietf.org/html/rfc7239#section-5.2As user of this filter, I would expect
X-Forwarded-For
orForwarded for=
to be handled and removed from the request. If there is a reason to not handleX-Forwarded-For
this should be documented.The text was updated successfully, but these errors were encountered: