Forum Discussion
rg-f5
Nimbostratus
Jun 07, 2025Create an iRule that can search and replace
Looking for some irule help please this is a search and replace rule... Step one in the message payload Find <soapenv:Header/> and replace with <soapenv:Header> <job:roleIdentifier>SERVER1...
Injeyan_Kostas
Cumulonimbus
Jun 07, 2025Assuming that you can identify server1 and 2 based on IP you can use below exmaple
when HTTP_REQUEST
{
switch [IP::client_addr]
{
"server1_IP"
{
set server "SERVER1"
HTTP::collect
}
"server2_IP"
{
set server "SERVER2"
HTTP::collect
}
}
}
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-f5
Nimbostratus
Jun 08, 2025thank you for your message, when you say identify the server, how can identify the server with irule code?
what if i just wanted to replace the below and then assign the irule to the virtual server, then i would have identified which server the message came from.
Step one in the message payload
Find <soapenv:Header/> and replace with
<soapenv:Header>
<job:roleIdentifier>SERVER1</job:roleIdentifier>
</soapenv:Header>
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