Forum Discussion
error: [undefined procedure: default][default { discard }]
Hello Guys, I have the below iRule and when I try to apply it I get the error - "error: [undefined procedure: default][default { discard }]"
When the users type in "https://topgear.com/current/cars/models" I want the traffic to hit the toyota_pool but if the users don't type anything in the uri and type "https://topgear.com" I just am looking to redirect it to "https://cars.com"
What am I missing here? - Thank you
when HTTP_REQUEST
{
set host [HTTP::host]
set hostLowered [string tolower $host]
set uri [HTTP::uri]
set uriLowered [string tolower $uri]
switch -glob $hostLowered
{
"topgear.*" {
if { $uriLowered contains "car" } then {
SSL::disable serverside
pool toyota_pool
} else {
if { $uriLowered equals "/" }
{ HTTP::respond 301 Location "https://cars.com" }
}
default { discard }
}
}
}
- Stanislas_Piro2Cumulonimbus
The closing curly bracket before default close the else statement... you have to add one more to close the switch top gear item!
- Lucas_de_Aguil1Nimbostratus
Try this indentation and with just two variables (performance +up):
when HTTP_REQUEST { set host [string tolower [HTTP::host]] set uri [string tolower [HTTP::uri]] switch -glob $host { "topgear" { if { $uri contains "car" } { SSL::disable serverside pool toyota_pool } else { if { $uri equals "/" } { HTTP::respond 301 Location "https://cars.com" } } } default { discard } } }
- DomaiAltostratus
Dammm thanks...I don't know how I missed that.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com