Forum Discussion
Create an iRule that can search and replace
Server 1 and Server 2 are both separate. I thought the irule can be attached to each server.
Oh when you say server you mean virtual server?
If so yes you can attach same irule to both virtual servers.
But again you somehow need to identify which virtual server was used.
You need to modify the request or the response?
- Injeyan_KostasJun 10, 2025
Cumulonimbus
So for virtual servers you can use [IP::local_addr clientside] instead of [IP::client_addr]
- rg-f5Jun 10, 2025
Nimbostratus
it's a request. And they will hit individual VIP's (Virtual Servers).
- Injeyan_KostasJun 10, 2025
Cumulonimbus
then you can try to apply this irule to both Virtual Servers
when HTTP_REQUEST { switch [IP::local_addr clientside] { "VIP_1" { set server "SERVER1" } "VIP_2" { set server "SERVER2" } } if {[info exists server]} { if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576} { set content_length [HTTP::header "Content-Length"] } else { set content_length 1048576 } } if { $content_length > 0} { HTTP::collect $content_length } } when HTTP_REQUEST_DATA { if {[info exists server]} { set payload [HTTP::payload] set new_header "<soapenv:Header><job:roleIdentifier>$server</job:roleIdentifier></soapenv:Header>" regsub {<soapenv:Header/>} $payload $new_header payload HTTP::payload replace 0 [string length [HTTP::payload]] $payload } }
- rg-f5Jun 11, 2025
Nimbostratus
Thank you, what fields would i edit for server ip or name? I'm thinking Server1 and Server2.
I'll give this a test on the irule.
What can i do if the message sent over doesn't have a soapheader and i need to insert one in?
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