- Newest
- Most votes
- Most comments
Hello, Swasti,
Thank you very much for your prompt response. We are deploying Apereo CAS behind the ALB. This application is based on Spring Boot and uses an embedded Tomcat server. As far as I know, there's no way to retrieve the last IP in the X-Forwarded-For header through configuration properties alone. It seems I would need to write a Java class to modify the RemoteIpValve in the embedded Tomcat. For now, I'll stick with the WAF rule that blocks requests containing the X-Forwarded-For header when they reach the ALB.
Best regards, Oscar.
answered 2 years ago
Hello,
I understand you have a usecase where you would like to remove X-forwarded-for header coming from the client and just add a new X-forwarded-for header with the actual Client IP that has sent the request.
At this moment, if you have Value as "Remove" for xff header processing mode, then ALB will remove the X-forwarded-for header all together and send the request to the target.
For now you can only use "Append" Value for xff header processing mode and the last IP address in that header that you will receive will be the Client IP, that has sent the request. You will need to create some sort of logic in your web application to get that "Last appended IP" and then decide if the request should be served or not by your servers, or whatever you want to do with the Client IP.
As of now I dont see any feature to change the behavior of these modes from AWS side.
answered 2 years ago
Relevant content
- AWS OFFICIALUpdated 4 years ago

yeah there is no custom made solution for this. You will have to write a custom code on the targets to start with. For now yes you can stick with WAF rules to block X-forwarded for headers. Thats the easiest way of blocking certain requests.