Forum Discussion
Solved - Remove Route Domain from iRule output
Hello, I have a test VIP that i've added an iRule to insert a custom header with the client IP, similarly to an X-Forwarded-For header (but with a custom name). The issue i'm running into is that the Bridge Domain number is being appended to the string.
ex: 1.1.1.1%111
i'm looking for a way to remove the "%111" from the string and insert the IP only in the header.
here is the iRule I have set:
when HTTP_REQUEST {
HTTP::header insert CLIENTIP [IP::client_addr]
}
I understand this is the default behavior for VIPs on the default partition.
sorry if i missed any articles that explain this, unfortunately my search didn't turn up anything iRule specific.
thanks in advance
You can use the
command to strip out the route domain ID appended to the client IP:getfield
when HTTP_REQUEST { HTTP::header insert CLIENTIP [getfield [IP::client_addr] "%" 1] }
- Rico
Cirrus
This should remove anything after the '%' sign
when HTTP_REQUEST { HTTP::header insert CLIENTIP [regsub {%.*} [IP::client_addr] ""]}
Recent Discussions
Related Content
* 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