Forum Discussion

fred_zeig77's avatar
fred_zeig77
Icon for Altostratus rankAltostratus
Jul 22, 2024

Advice to partial rename uri path

Hi there masters!   I would like to ask for advice. Is there a possibility that after I redirect an URL I can partial rename the 1st two paths in the redirected URI path? So, for example: when cli...
  • CA_Valli's avatar
    Jul 23, 2024

    That's some very specific stuff you're trying to achieve .. 

    If the "client URL" you want to display does not exist on the server, I think you'll need two instructions in the iRule, one to redirect client to target URI and one to change this string before it connects to the webserver. 

    You might try something similar to this

    when HTTP_REQUEST {
      if { [HTTP::host] equals "companyA.com" }{ 
        #I'm using a switch statement so it's easier to add/change uri behavior in the future
        switch -glob [HTTP::path] {
          "/" { HTTP::redirect "https://[HTTP::host]/bed/table/r/Home" }
          "/bed/table/r/Home" { HTTP::path "/room/desktop/r/Home" } 
        }
      }
    }