error irules with regexp on HTTP::host
Hello,
I'm new to devcentral, can you help me for a default configuration of an irules.
here the irulewhen HTTP_REQUEST {
set i 0
set host [string tolower [HTTP::host]]
if { $host matches_regex {^.*\.\w+\.\w+$} } {
log local0. "on entre dans le regex"
regexp {^.*\.([w]+\.[w]+)$} [string tolower [HTTP::host]] -> endofhost
log local0. "dans le regex host : $host ; test end of host : $endofhost"
set i 1
}
if { $i == "0" } {
log local0. "i=$i"
if { ! ( [class match $host equals HTTP_exception_url_for_source_ip]) }{
log local0. "dans le match host : $host "
snat automap
forward
}
}
if { $i == "1" } {
log local0. "i=$i"
if { ! ( [class match $endofhost equals HTTP_exception_url_for_source_ip]) }{
log local0. "dans le match endofhost : $endofhost "
snat automap
forward
}
}
}
here the ltm log :
Jun 9 15:50:15 local/tmm info tmm[4880]: Rule irule_IP_and_url_exception : on entre dans le regex Jun 9 15:50:15 local/tmm err tmm[4880]: 01220001:3: TCL error: irule_IP_and_url_exception - can't read "endofhost": no such variable while executing "log local0. "dans le regex host : $host ; test end of host : $endofhost""
So my default is here : regexp {^.*.(w+.w+)$} [string tolower [HTTP::host]] -> endofhost
I want to catch the domain to the variable endofhost (why ? because i have got a datagroup list that only have domain on it, and i have to forward if it's match.)
if www.google.fr ==> endofhost = google.fr
I search for hours on devcentral /ask F5, i don't figure the solution...
Is there a good soul to help ,me ?
Best Regards,