Forum Discussion

RyanF5_169352's avatar
RyanF5_169352
Icon for Nimbostratus rankNimbostratus
Jul 29, 2015

iRule to add uri after "/"

I've got a web server that hits IIS. I need an iRule that basically says if there nothing after the "/" put "XXXXX" in. For examply, users will navigate to wms-xxx.domain.com and get the IIS page. I want this to redirect them to wms-xxx.domain.com/xxxxxx

 

when HTTP_REQUEST { if {( [HTTP::uri] equals "/" )} { HTTP::respond "https://wms-ind.smcusa.com/wmsprod log local0. "in HTTP_REQUEST"

 

5 Replies

  • Pretty close:

    when HTTP_REQUEST { 
        if { [HTTP::uri] equals "/" } { 
            HTTP::redirect "https://wms-ind.smcusa.com/wmsprod" 
        }
    }
    
  • it's not redirecting to the /wmsprod. I have another rule in place that reverts HTTP to HTTPS but that shouldn't impose on this rule.

     

  • Conceivably you should only have the HTTP-to-HTTPS iRule on the HTTP VIP, while the above should only be on the HTTPS VIP.

     

  • It actually worked after I applied it to both HTTP VIP and the HTTP VIP. Thanks for your help!

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    Don't forget to consider other URLs to the root, like /default.aspx.