Forum Discussion
Nick_T1
Nimbostratus
Feb 18, 2016Stripping headers on response depending on client IP
We're looking to strip some internal headers at the bigip if the client IP is not internal. We could do this in iRules, but it seemed like a good use case for a more rigid/optimized policy. Would it ...
Kai_Wilke
MVP
Feb 18, 2016Hi Nick,
you may try this iRule as a starting point...
when CLIENT_ACCEPTED {
if { ( [IP::addr [IP::client_addr] equals 10.0.0.0/8] ) or
( [IP::addr [IP::client_addr] equals 172.16.0.0/12] ) or
( [IP::addr [IP::client_addr] equals 192.168.0.0/16] ) } then {
set external_client 0
} else {
set external_client 1
}
}
when HTTP_RESPONSE {
if { $external_client } then {
HTTP::header remove SILLY_HEADER1
HTTP::header remove SILLY_HEADER2
HTTP::header remove SILLY_HEADER3
HTTP::header remove SILLY_HEADER4
}
}
Note: If you internal Network is more complex, then you may also checkout the [class match] command using IP address based datagroups.
Update: Corrected the code to strip the header for external clients.
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
