Forum Discussion
Create an iRule that can search and replace
It depends how is your topology.
If you you a specific VS fo each server then you don't need to identify it.
But if you have one VS then you somehow need to know which server it is.
You can use IPs, headers, cookies, or whatever unique application may has.
Server 1 and Server 2 are both separate. I thought the irule can be attached to each server.
- Injeyan_KostasJun 10, 2025
Nacreous
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
Nacreous
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
Nacreous
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 } }
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