application port number rewrite while keeping everything after port number
Hello,
I'm very novice with irules, so apologies if this has been answered before, I might need this to be spelled out better. I have a need to redirect a particular api endpoint to another port on the same vip, retaining everything after the port number. This needs to happen transparently with no redirect status codes.
For example, I'm doing an http post to http://stg-application.company.com:8081/api/taxServices/quotation, but that needs to redirect to http://stg-application.company.com:8084/api/taxServices/quotation. There is a json payload with this http post
I have different Virtual servers for each port (same LB ip different pools for each port)
VirtualServer1 - 10.13.99.10 - service port 8081
Pool1 - 2 members - port 8081
VirtualServer2 - 10.13.99.10 - service port 8084
Pool2 - 2 members - port 8084
iRule is applied to VirtualServer1
Here is one of my failed attempts, I think I'm missing something important:
when HTTP_REQUEST {
if {([HTTP::uri] starts_with "/api/taxServices")}
{HTTP::header replace Host "http://stg-application.company.com:8084"}
}