Forum Discussion
James_41967
Oct 10, 2017Nimbostratus
iRule syntax error - undefined procedure
I'm trying to write this iRule that switches pools based on the path it sees, but I'm getting a syntax error:
01070151:3: Rule [/Common/test_irule_v4] error: /Common/test_irule_v4:17: error: [undefined procedure: default][default] /Common/test_irule_v4:13: error: [undefined procedure: drop ][if {[HTTP::path] starts_with "/patha"} { pool patha_prod_443_pool } elseif {[HTTP::path] starts_with "/" } { pool prod_443_pool }default { drop }]
when HTTP_REQUEST {
switch -exact -- [string tolower [HTTP::host]] "url-uat.something.com" {
if {[HTTP::path] starts_with "/patha"} {
pool patha_uat_443_pool
} elseif {[HTTP::path] starts_with "/pathb" } {
pool pathb_uat_443_pool
} elseif {[HTTP::path] starts_with "/" } {
pool uat_443_pool
} else {
drop
}
} "url-prod.something.com" {
if {[HTTP::path] starts_with "/patha"} {
pool patha_prod_443_pool
} elseif {[HTTP::path] starts_with "/" } {
pool prod_443_pool
} default {
drop
}
}
}
- James_41967Nimbostratus
Figured it out...had a close bracket in the wrong place!
This works:
when HTTP_REQUEST { switch -exact -- [string tolower [HTTP::host]] "url-uat.something.com" { if {[HTTP::path] starts_with "/patha"} { pool patha_uat_443_pool } elseif {[HTTP::path] starts_with "/pathb" } { pool pathb_uat_443_pool } elseif {[HTTP::path] starts_with "/" } { pool uat_443_pool } else { drop } } "url-prod.something.com" { if {[HTTP::path] starts_with "/patha"} { pool patha_prod_443_pool } elseif {[HTTP::path] starts_with "/" } { pool prod_443_pool } } default { drop } }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects