http request re-write

Hi,

I need help to rewrite the http request for below requirement.Request your help. I was trying below irule; but it is not working.

Original request on F5 VIP

.xyz Domain Names | Join Generation XYZ

Need to rewrite to below URL before request send to pool member

.xyz Domain Names | Join Generation XYZ

when HTTP_REQUEST {

if { ([HTTP::host] equals "xyz.com") and ([HTTP::path] equals "/sme/mobile-webconsole") } {

    HTTP::path "/mobile-webconsole"
}

}

Regards, Anil

Hi Anil

Try using HTTP::uri instead of HTTP::path

HTTP::path

should be fine for the rewrite, and generally, is preferred (since it maintains any request parameters). I recommend adding logging, as in:

when HTTP_REQUEST {
    log local0. "host = [HTTP::host]; path = [HTTP::path]"
    
    if { [string tolower [HTTP::host]] eq "xyz.com" and [HTTP::path] eq "/sme/mobile-webconsole" } {
        log local0. "  .. matches"
        HTTP::path "/mobile-webconsole"
    }
}

to see what’s going on.