URL redirect based on content

Hi,

I am new to iRules and need help achieving redirect based on content

e.g if my URL is https://xxx.abc.com/xyz then it should redirect to https://yyy.xyz.com/nnn/ppp

Please can you provide iRule for above scenario.

Hi,

You can use the following irule :

when HTTP_REQUEST {
    if { [HTTP::host] eq "xxx.abc.com" and [HTTP::path] eq "/xyz" } {
        HTTP::respond 302 Location "https://yyy.xyz.com/nnn/ppp"
    }
}

Hi,

You can use the following irule :

when HTTP_REQUEST {
    if { [HTTP::host] eq "xxx.abc.com" and [HTTP::path] eq "/xyz" } {
        HTTP::respond 302 Location "https://yyy.xyz.com/nnn/ppp"
    }
}

Many thanks for a super fast response. I’ll try this out and let you know how this goes. Really appreciate

Many thanks for a super fast response. I’ll try this out and let you know how this goes. Really appreciate

Does the HTTP_REQUEST get triggered for HTTPS as well? Also, for this to work, do we need to be doing SSL offload? Isn’t the hostname in the HTTP headers, which would be encrypted?

Does the HTTP_REQUEST get triggered for HTTPS as well? Also, for this to work, do we need to be doing SSL offload? Isn’t the hostname in the HTTP headers, which would be encrypted?

Hi, Yes this event is triggered also by https but only if you do ssl offloading or bridging (attach clientssl/serverssl profiles). When using SSL, all the flow is encrypted, but with ssl offloading, headers are in plain text

Hi, Yes this event is triggered also by https but only if you do ssl offloading or bridging (attach clientssl/serverssl profiles). When using SSL, all the flow is encrypted, but with ssl offloading, headers are in plain text