Forum Discussion

Tom_89796's avatar
Tom_89796
Icon for Nimbostratus rankNimbostratus
Jan 12, 2013

irule not appending IP

Have the following irule for appending IP address to uri on incoming requests. login and login2 append IP address as expected, ACCGateway in uri is not appending IP address as expected.

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::uri]] {

 

"*login.aspx" -

 

"*login2.aspx" -

 

"*ACCGateway.aspx" {

 

HTTP::uri "[HTTP::uri]?IPAddress=[getfield [IP::client_addr] % 1]"

 

}

 

"*login.aspx\?*" -

 

"*login2.aspx\?*" -

 

"*ACCGateway\?*" {

 

HTTP::uri "[HTTP::uri]&IPAddress=[getfield [IP::client_addr] % 1]"

 

}

 

}

 

}

 

3 Replies

  • Make sure to put your switch cases in lowercase as you're setting the URI to lowercase for the switch comparison.

     

     

    Aaron
  • OK, so changing it to the below, but it is still not appending the IP address as expected. The get request conatins this directly - /ACC/ACCGateway.aspx?

     

    I tried adding .aspx to the second entry of accgateway as well with no luck so far. I believe that .aspx should be there?

     

     

    when HTTP_REQUEST {

     

    switch -glob [string tolower [HTTP::uri]] {

     

    "*login.aspx" -

     

    "*login2.aspx" -

     

    "*accgateway.aspx" {

     

    HTTP::uri "[HTTP::uri]?IPAddress=[getfield [IP::client_addr] % 1]"

     

    }

     

    "*login.aspx\?*" -

     

    "*login2.aspx\?*" -

     

    "*accgateway.aspx\?*" {

     

    HTTP::uri "[HTTP::uri]&IPAddress=[getfield [IP::client_addr] % 1]"

     

    }

     

    }

     

    }

     

  • actaully looks like it worked with the change to lower case in the compare. Just didn't wait long enough, must have been cached in my browser