Forum Discussion

Geoff_34657's avatar
Geoff_34657
Icon for Nimbostratus rankNimbostratus
Apr 24, 2013

HTTP:URI no ending slash

So I am using the following iRule and it works properly but, it doesn't work unless there is an ending / or it is a complete URL with filename. I have been searching through the examples and there is only one that works but, it uses a datagroup and I am just wondering if there is a simpler way to make this happen.

 

 

domain.com/test/ and domain.com/test/test.aspx work properly but, domain.com/test does not work properly. Is there away to make this work properly?

 

 

when HTTP_REQUEST {

 

if {[HTTP::uri] starts_with "/Testing"}{

 

log local0. "1. Client [IP::client_addr]: client requested [HTTP::host][HTTP::uri]"

 

pool A

 

}

 

else {

 

log local0. "2. Client [IP::client_addr]: client requested [HTTP::host][HTTP::uri]"

 

pool B

 

}

 

}

 

3 Replies

  • If I understand your request, something like this should work (very similar to what you already have).

    
    when HTTP_REQUEST {
         if { [string tolower [HTTP::uri]] starts_with "/test" } {
              pool A
         } else {
              pool B
         }
    }
    

    Now, if you mean that you want to differentiate between "/test" (explicit) or "/test*" (something that starts with "/test"), then your conditional should flow from most specific to least specific. For example, if URI equals "/test", do A, else if URI starts with "/test", do B.
  • It appears to be an IE issue.

     

    When I got to http://domain.com/test it does nothing.

     

    When I got to http://domain.com/test/ with the ending / then the rule works properly.

     

     

    Not sure if there is anything I can do about this
  • Please put a log statement at the beginning of your HTTP_REQUEST event and review/report the findings.

     

     

    log local0. "URI = [HTTP::uri]"