Forum Discussion
Using iRule to block a URL in Virtual server but doesn't work
I created a virtual server for a web site (10.11.12.100, www.abc.com) and using irule want to block a sub-site "www.abc.com/xyz" with below irule command but seems not work, please advise.
when HTTP_REQUEST { if { ( [string tolower [HTTP::path]] contains "/xyz" ) } { log local0. "dropped" HTTP::respond 200 content "URL Blocked" } }
9 Replies
it is working for me:
curl -v http://10.3.22.85/xyz Jul 28 21:27:40 bigip-01 info tmm1[21016]: Rule /Common/irule-devcentral-test : droppedwhat isn't for you?
- Yann_Desmarest_
Nacreous
Hi,
Do you have other irules attached to your Virtual Server ?
Can you check ltm logs in /var/log/ltm looking for TCL errors. Typical case is when you see this kind of log :
Operation not supported. Multiple redirect/respond invocations not allowed- Paul_125684
Nimbostratus
no any message related of this
what does happen? if you start with a log message is that shown? first determine the basics before trying all kind of variations.
Hi,
Do you have other irules attached to your Virtual Server ?
Can you check ltm logs in /var/log/ltm looking for TCL errors. Typical case is when you see this kind of log :
Operation not supported. Multiple redirect/respond invocations not allowed- Paul_125684
Nimbostratus
no any message related of this
what does happen? if you start with a log message is that shown? first determine the basics before trying all kind of variations.
- JG
Cumulonimbus
Try this instead:
when HTTP_REQUEST { if { [string tolower [HTTP::path]] starts_with "/xyz" } { log local0. "dropped" HTTP::respond 200 content "URL Blocked" reject } }.
[Edit: Added reject, just for your testing]
- Raj_Bhatia_1778
Nimbostratus
Do you really want a response back. Try closing the TCP connection & disabling all events after the response is send.
when HTTP_REQUEST { if { ( [string tolower [HTTP::path]] contains "/xyz" ) } { log local0. "dropped" HTTP::respond 200 content "URL Blocked" Connection "Close" TCP::close event disable all }}
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