Forum Discussion
Andrew_7467
Sep 08, 2011Nimbostratus
Insert something into header to distiguish public and private IP Addresses
All, I am working with our developers and need some assistance. What they would like to do is insert a custom header based on the client address. If it is RFC1918 addresses (172.18.0.0, 192.168.0.0...
hooleylist
Sep 08, 2011Cirrostratus
Hi Andy,
Can you try this:
when CLIENT_ACCEPTED {
if { [IP::addr [IP::remote_addr] equals 172.16.0.0/12] or [IP::addr [IP::remote_addr] equals 10.0.0.0/8]}{
HTTP::header insert "user_type" "internal_user"
} else {
HTTP::header insert "user_type" "external_user"
}
}
I think you had a few issues with the masks in the IP::addr command, spaces around the brackets and needing a header name and value for the HTTP::header insert command.
If this doesn't work, can you post the error from the iRule editor?
Aaron
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