Forum Discussion
mfarooq
Nimbostratus
Jul 11, 2024irule syntex verification
i built below irule to block all other countries accept Saudi arabia. but i am getting errors on F5 when want to save it. below are the errors. when HTTP_REQUEST { # Define the URI to be prote...
Paulius
MVP
Jul 12, 2024I believe the following will work.
when HTTP_REQUEST priority 500 {
# Define the URI to be protected
set protected_uri "/uri"
# Define the allowed Country
set allowed_country "SA"
# Get the country code from the client's IP address
set client_ip [IP::client_addr]
set client_country [whereis $client_ip country]
# check if the URI matches and if the country is allowed
if { (([HTTPS::uri] equals ${protected_uri}) && (${client_country} != ${allowed_country})) } {
# Send a 403 Forbidden response
HTTP::respond 403 content "Access denied"
}
}
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