duderoot
duderoot

Reputation: 987

Spring-Security getRemoteAddress for app behind proxy

Is there a reason why the Spring-Security dose not provide any possibility to lookup for the RemoteAddress when the application is located behind a proxy e.g. load balancer, apache httpd server? At the moment the WebAuthenticationDetails object is saving the ip of the proxy. I saw that there are also solution for finding the remote address over the X-FORWARDED-FOR header attribute. I am curios is a reason why this is not provided?

Upvotes: 1

Views: 1067

Answers (1)

dur
dur

Reputation: 17009

If you use Tomcat, you could configure RemoteIpValve.

Tomcat port of mod_remoteip, this valve replaces the apparent client remote IP address and hostname for the request with the IP address list presented by a proxy or a load balancer via a request headers (e.g. "X-Forwarded-For").

Upvotes: 1

Related Questions