Forum Discussion

Robert_LaGrasse's avatar
Robert_LaGrasse
Icon for Nimbostratus rankNimbostratus
Jul 13, 2006

Append incoming request with client IP

Probably a very simple task for you iRule gurus out there, not so simple for my first iRule. Here's what I'm trying to accomplish... when the client request comes in to the login.aspx page on my host, I want to append an & or ? and his IP address to the uri. Here's what I've built, which is not working.

 

 

when HTTP_REQUEST {

 

set client [IP::client_addr]

 

set request [HTTP::uri]

 

if {$request contains "login.aspx" and $request contains "?"}

 

{HTTP::uri {$request + "&IPAddress=" + $client}}

 

elseif {$request contains "login.aspx"}

 

{HTTP::uri {$request + "?IPAddress=" + $client}}

 

}

 

 

Really nice pseudo code, but obviously not syntactically correct. This results in the F5 sending a GET / $request + "IPAddress=" + $client to my server, which it's obviously not finding. So, how do I fix it?

 

 

Thanks!

 

-B