Forum Discussion
breizho35_11667
Nimbostratus
Feb 08, 2010How to read source IP and write http header ?
Hello,
since commencing in iRules, I seek your help to write a script to meet this need:
How to read source IP and write http header ?
when HTTP_Request ( ...
hoolio
Cirrostratus
Feb 08, 2010Actually, maybe not. Maybe he just wants the periods removed and to take the last 10 characters? If so, something like this should work too:
when CLIENT_ACCEPTED {
Remove the .'s from the client IP and take the last 10 digits
set ip_string [string map {"." ""} [IP::client_addr]]
set ip_string [string range $ip_string [expr {[string length $ip_string] - 10}] end]
}
when HTTP_REQUEST {
Insert the HTTP header
HTTP::header replace TOTO $ip_string
}
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