Forum Discussion
Geolocation irule with HTTP response
I am trying to modify the following irule that is set to block connections from Germany, to display a message to the end user that thier connection is blocked. I added 'when http_request' command at the end of the irule below but it doesnt seem to go well with the switch command, something about not supported/invalid combination. Any help would be much appreciated. Thanks in advance.
when CLIENT_ACCEPTED {
set default_pool [LB::server pool] switch [whereis [IP::client_addr] country] {
DE {
log local0. "Geo Client ([IP::client_addr]) detected as Germany"
reject
}
default { pool $default_pool }
}
}
2 Replies
- Richard__HarlanHistoric F5 Account
You can try something like this
when HTTP_REQUEST { set default_pool [LB::server pool] switch [whereis [IP::client_addr] country]{ DE { log local0. "Geo Client ([IP::client_addr]) detected as Germany" HTTP::respond 500 content { Apology Page We are sorry, but you are not allowed access to this site from you geographic location } } default { pool $default_pool } } } - SK_121993
Nimbostratus
Thanks Richard! That compiles without any errors, tested OK.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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