Forum Discussion
Need iRule to block the traffic for specific URL
Thanks for that , Should be OK with sending
HTTP::respond 403
If i need to filter specific Source IPs say from Whitelist1 Data group allow it, block rest of it for the same URL "www100.test.com/ce". How do i match the condition with the below iRule.
when HTTP_REQUEST {
if { [string tolower "[HTTP::host][HTTP::path]"] starts_with "www100.test.com/ce" } then {
HTTP::respond 403 content "<html><body><h1>Access Denied</h1></body><html>" "Content-Type" "text/html"
}
Thanks
Sounds like the piece you are looking for is a class match for the whitelist.
when HTTP_REQUEST {
if { [string tolower "[HTTP::host][HTTP::path]"] starts_with "www100.test.com/ce" } then {
if { [class match [IP::client_addr] equals Whitelist1] } {
log local0.info "TESTCE: Acceptable usage from [IP::remote_addr]"
} else {
HTTP::respond 403 content "<html><body><h1>Access Denied</h1></body><html>" "Content-Type" "text/html"
return
}
}
You can also have a pool selection with the log statement if the traffic goes to a specific pool. You can also just negate the "if" condition if you only want to action if the IP is not in the whitelist.
Scott
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
