Forum Discussion

oninicus_162976's avatar
oninicus_162976
Icon for Nimbostratus rankNimbostratus
Feb 12, 2018

URI Append

Hi Experts,

 

Could you please help me write the irule to append a string to existing URI? Below are the details. Can it be just a rewrite and not redirect?

 

The idea is to append/insert a URI, Can i have it as variable? coz it should take the word/strings before the domain name and use it as the URI to be added. Original URL sent by user: online.abc.com/ova/login.jsp traffic sent to backend server should be: online.abc.com/online/ova/login.jsp

 

Thanks in advance for the help!

 

2 Replies

  • Here an example:

    when HTTP_REQUEST {
    if {[HTTP::uri] eq "/ova/login.jsp" and [HTTP::host] eq "online.abc.com"} {
        HTTP::uri /[getfield [HTTP::host] "." 1][HTTP::uri]
        }
    }
    
  • Hi, you can try this (you may want to add some conditioning, but you get the idea)

    when HTTP_REQUEST {
        set domainPrefix [getfield [HTTP::host] "." 1]
        HTTP::uri /$domainPrefix[HTTP::uri]
    }