mister_65355
Jun 19, 2007Nimbostratus
limited Web
Hi All,
I will like limited the accesses Web only for http://@IP_serveur/test/ (for example only for /test/ and /test2/)
What I can make?
Thanks
I will like limited the accesses Web only for http://@IP_serveur/test/ (for example only for /test/ and /test2/)
What I can make?
Thanks
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/test/"}{
pool Pool1
} elseif {[HTTP::uri] starts_with "/test2/"}{
pool Pool1
}
}
then, permit only http://SERVEUR/test/ and http://SERVEUR/test2/
I don't think that the last solutions is the best!! :-)
when HTTP_REQUEST {
if { [HTTP::host] == "app.example.com"}{
pool Pool1
} elseif {[HTTP::uri] contains "/test/"} {
pool Pool1
} elseif {[HTTP::uri] contains "/info/"} {
pool Pool1
} elseif {[HTTP::uri] contains "/test1/"} {
pool Pool1
} elseif {[HTTP::uri] contains "/test2/"} {
pool Pool1
} else {
reject
}
}
What can I do?
Thanks.
With that said, since all of your elseif's are comparing the same value (HTTP::uri), then you can replace that section with a switch statement which is higher performing than if/elseifs. Something like this:
when HTTP_REQUEST {
if { [HTTP::host] == "app.example.com"}{
pool Pool1
} else {
switch -glob [HTTP::uri] {
"*/test/*" -
"*/info/*" -
"*/test1/*" -
"*/test2/*" {
pool Pool1
}
default {
reject
}
}
}
}
These two iRules should be functionally equivalent though.
Hope this helps...
-Joe