Forum Discussion

leozh_54300's avatar
leozh_54300
Icon for Nimbostratus rankNimbostratus
Jan 08, 2010

HTTP::Redirect Question

I am trying to make an iRule that does an HTTP::Redirect as follows:

 
 when HTTP_REQUEST { 
 if { [HTTP::host] equals"subdomain.xxxxx.com"} { 
     HTTP::redirect "http://subdomain.xxxxx.com/parameter?yyyy=ZZ" 
 } 
 }

Does the question mark in the URL have to be escaped or should it be ok as is?

Thanks!

3 Replies

  • Hi Leozh,

     

    The question mark is fine. It's simply a redirect to however you want the client to redirect.

     

     

    Bhattman
  • You'll need to add a space between equals and "subdomain.xxx.com". And if this iRule is added to the HTTP virtual server, you might want to add a check for the path. Else I think you'll get an infinite loop of redirects to http://subdomain.xxxxx.com/parameter?yyyy=ZZ.

     
     when HTTP_REQUEST {  
        if { [string tolower [HTTP::host]] eq "subdomain.xxxxx.com" && [HTTP::path] eq "/"} {  
           HTTP::redirect "http://subdomain.xxxxx.com/parameter?yyyy=ZZ"  
        } 
     } 
     

    Aaron