URL Rewrite Help

hi,

I am trying to write an IRULE for URL rewrite but and looked at the ones online but none seems to be working. The virtual server is set to "standard with default http profile and here is what I need:

https://abc.com Actual URL
https://abc.com/ui/ Re-written URL

https://abc.com/ Actual URL
https://abc.com/ui/ Re-written UR

https://abc.com/ui Actual URL
https://abc.com/ui/ Re-written UR

http://abc.com Actual URL
http://abc.com/ui/ Re-written UR

http://abc.com/ Actual URL
http://abc.com/ui/ Re-written UR

http://abc.com/ui Actual URL
http://abc.com/ui/ Re-written UR

any help will be highly appreciated.

thanks

when HTTP_REQUEST {
  if {[HTTP::path] eq "/"}{ HTTP::path "/ui/" }
}

Hi,

I tried this but it doesnt seem to be working.

@Qasim What is occurring when you make this change? What are you seeing on your tcpdump between the F5 and the client? You can try adding the following line to see what you see in the F5 logs.

when HTTP_REQUEST {

    if {[HTTP::path] eq "/"}{
        HTTP::path "/ui/"
        log local0. "The HTTP Path is now [HTTP::path]" 
    }

}

Are you running tests over HTTPS? 
Does your VS decrypt this traffic with ssl profiles?

Hi,

the backend servers have http and https both services running and  VS has no SSL pofile so no decryption on F5.

thanks

@Qasim If you are not performing SSL termination for this VS you will not be able to look at the HTTP header and manipulate it using iRules or traffic policies. If you must perform this function at the F5 then you will need to perform SSL termination.

if {[string tolower [HTTP::Host]] equals "abc.com" } {
    HTTP::header replace Host "abc.com"
    HTTP::uri "/ui/"
}
When HTTP_Request{
if {[string tolower [HTTP::Host]] starts_with "abc.com"} {
    HTTP::header replace Host "abc.com"
    HTTP::uri "/ui/"
}
}