HTTP_REQUEST - invalid command name "1.1.1.1%1" while executing "$client_ip equals "2.2.2.2""

Hi guys, I try to do something that looks not difficult, but i’m really stucked. Any help is welcome.

I just want to check the remote client ip and push an ifile proxy.pac to him, and if not i want to push the default one.

I don’t understand anything about how to post code there, with the autmatic html formating.Is it so complicated ?

Are you using "Route Domains? If so, it’s probably your error. Example from one of my irule; set userip [getfield [IP::client_addr] “%” 1] switch -glob -- $userip { “10.10.10.*” - “10.10.11.*” - “10.10.13.*” { Do what you want! } default { the default }}

Also, if you need to known the routing domain from an irule; [ROUTE::domain]

Hi Steph, i do use one RD.

Well, i use the IP::remote_addr which do gather the ip address with the “%1”. It seems to be a mistake in this line :

when HTTP_REQUEST {

set client_ip [IP::remote_addr]}

if {[$client_ip equals “1.1.1.1”]} (this line!)

{switch -glob [HTTP::uri] (etc…)

Try to dump values [IP::remote_addr] and [IP::client_addr] into your local0.info log. Then try some connection and check your /var/log/ltm.

Yes, Steph. I did that. The remote_addr value is my correct ip address with %1 at the end. (1.1.1.1%1). But TCL keep telling me that the command is invalid, while executing "client_ip equal “1.1.1.1"”

if {[$client_ip equals "1.1.1.1"]}

should be

if {$client_ip equals "1.1.1.1"}

or equals “1.1.1.1%1” potentially in your case

Absolutely. Thank you Josiah.

IP address comparisons were discussed quite thoroughly in this old DevCentral post. Pay particular attention to the first comment, which discusses how to strip the route domain indicator from the test address.