Forum Discussion

Qasim's avatar
Qasim
Icon for Cirrostratus rankCirrostratus
May 12, 2023

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

8 Replies

  •  

    when HTTP_REQUEST {
      if {[HTTP::path] eq "/"}{ HTTP::path "/ui/" }
    }
  • Qasim's avatar
    Qasim
    Icon for Cirrostratus rankCirrostratus

    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? 

      • Qasim's avatar
        Qasim
        Icon for Cirrostratus rankCirrostratus

        Hi,

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

         

         

        thanks

  • if {[string tolower [HTTP::Host]] equals "abc.com" } {
        HTTP::header replace Host "abc.com"
        HTTP::uri "/ui/"
    }
    • Prasad4u's avatar
      Prasad4u
      Icon for Nimbostratus rankNimbostratus
      When HTTP_Request{
      if {[string tolower [HTTP::Host]] starts_with "abc.com"} {
          HTTP::header replace Host "abc.com"
          HTTP::uri "/ui/"
      }
      }