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.
- Injeyan_KostasJun 08, 2025
Cumulonimbus
Another one is that you don't specify if this is a request or a response.
So my example is for request.
If you need it for a response it needs to be adjusted accordingly.
- rg-f5Jun 08, 2025
Nimbostratus
The message will come through from an application to the Virtual Server, i'm not sure if this is a response or a request. The message will not have a role identifier. Hence I have to add in the following irule.
Let's start with it being one virtual server and we want a basic example to get the irule started to search and replace.
This is a message sent from the application, and an irule to replace <soapenv:Header/> with <soapenv:Header>
<job:roleIdentifier>SERVER1</job:roleIdentifier>
</soapenv:Header>Step one in the message payload
Find <soapenv:Header/> and replace with
<soapenv:Header>
<job:roleIdentifier>SERVER1</job:roleIdentifier>
</soapenv:Header>
- rg-f5Jun 09, 2025
Nimbostratus
Server 1 and Server 2 are both separate. I thought the irule can be attached to each server.
- Injeyan_KostasJun 10, 2025
Cumulonimbus
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]
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