Forum Discussion

john_waterworth's avatar
john_waterworth
Icon for Nimbostratus rankNimbostratus
Oct 14, 2014

after upgrading from 11.2 to 11.6 now getting irule warning

I am getting the following warning.............

/Common/ehis-search-usinode-v2p:8: warning: ["\A" has no meaning. Did you mean "\A" or "A"?][{\A/conn/([^/]+)}]

Here is the iRule............

when RULE_INIT { set static::pool_prefix "ehis-usinode-conn-" }

when HTTP_REQUEST { set path [URI::path [HTTP::path]][URI::basename [HTTP::path]]

log local0. "Path \"$path\""
if {[regexp {\A/conn/([^/]+)} $path dummy nodename]} { 
log local0. "Node name \"$nodename\""
    if {[catch {
            pool "$static::pool_prefix$nodename"
                } ]
       } {
        HTTP::respond 400 content "400 Bad RequestUnknown node $nodename"
    } else {
    }
}

}

2 Replies

  • I'm really not sure what this line is doing, can you elaborate please;

    set path [URI::path [HTTP::path]][URI::basename [HTTP::path]]
    
  • . I used that construction because I wanted to pick up just the path. [HTTP::path] includes the hostname and protocol fields. [URI::path] gives everything up to the last slash. [URI::basename] gives you the piece after the last slash. I thought it looked too complicated, but that was what seemed to work.

     

    Looking at the docs on devcentral, I may have been misunderstanding it. It did look too complicated.

     

    Also, I think there’s somewhere else some lore that [HTTP::path] gives you everything that was offered after the method on the HTTP command line. If a client happened to deliver the request in the form it would be in should it think that it’s talking to a proxy, that can contain the whole path.

     

    Normally, an HTTP request looks like:

     

    GET /index.html HTTP/1.1

     

    And [HTTP::path] has the value “/index.html”.

     

    However, if the client thinks it’s talking to a proxy, the HTTP request looks like this:

     

    GET http://foo.bar.com/index.html HTTP/1.1

     

    The web server would treat these two requests identically, I believe, but in the second case [HTTP::path] would be “http://foo.bar.com”.

     

    I’ve never tested this; I just did it because I read something on Devcentral recommending that you do so.