Forum Discussion

adrian_171483's avatar
Oct 06, 2016
Solved

Irule to "prepend" directory and retain URI

Hi. i have a requirement for the following:   type somesite.com/anything/anything   then we need to add /something into the URI without a redirect and retain the original client URI reques...
  • adrian_171483's avatar
    Nov 04, 2016
    when HTTP_REQUEST {
        HTTP::header replace Host "[HTTP::host]:38080"
        log local0. "Sending request to server"
        Log the original path if debug is enabled
       if {$::uri_mapping_debug}{log local0. "Original path: [HTTP::host][HTTP::uri]"}
    
        If the path doesn't already start with the base URI and version, insert it
       if {[string tolower [HTTP::path]] starts_with "/api/"}{
          HTTP::path "/imr-ce-web[HTTP::path]"
    
           Log the modified path if debug is enabled
          if {$::uri_mapping_debug}{log local0. "Modified path: path: [HTTP::host][HTTP::uri]"}
       }
    }