Forum Discussion
danielng_19608
Nimbostratus
Apr 28, 2009Customizing X-Forwarded-For certain websites
Hi all,
currently my setup is to enable X-Forwarded for all traffic that is hitting the Internet.
What i would like to do is to NOT enable X-Forwarded when accessing certain websites.
My idea of the iRule will be something like this:
==================================================================================
when CLIENT_ACCEPTED {
if { [matchclass [IP::client_addr] equals $::trustedAddresses] }
{
forward
}
else {
HTTP::header insert X-Forwarded-For [IP::remote_addr]
forward
}
Can anyone tell me if this solution will work?
Thanks!!
6 Replies
- hoolio
Cirrostratus
If you want to inspect/modify the HTTP content, you need to add an HTTP profile to the virtual server. You would also need to move the logic to the HTTP_REQUEST event where the HTTP headers have been parsed by TMM. And assuming you have a pool on the VS, you could remove the forward statements and just use a single if:when CLIENT_ACCEPTED { Check if client IP isn't part of trusted addresses datagroup if { [matchclass [IP::client_addr] equals $::trustedAddresses] }{ set insertXff 0 } else { set insertXff 1 } } when HTTP_REQUEST { Check if we're inserting an XFF for this connection if { $insertXff}{ Remove existing XFF headers HTTP::header remove X-Forwarded-For Insert new XFF header HTTP::header insert X-Forwarded-For [IP::remote_addr] } }
- danielng_19608
Nimbostratus
Hi Aaron, - danielng_19608
Nimbostratus
hi Aaron, - hoolio
Cirrostratus
What did you end up with? - danielng_19608
Nimbostratus
Hi Aaron, - hoolio
Cirrostratus
Can you replace this line:
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects