Forum Discussion
OviShare_69630
Nimbostratus
Sep 21, 2009Ignore a rule
I am trying to create a rule where certain content is blocked from being accessed outside of my site. I tried this rule:
when HTTP_REQUEST {
if {[matchclass [HTTP::u...
OviShare_69630
Nimbostratus
Sep 25, 2009I figured out my problem. This code:
when HTTP_REQUEST {
if {not [matchclass [HTTP::header "Referer"] contains ".mysite.com"]} {
}
}
Is incorrect. I should not have been using "matchclass" in this case, and thus the broken code was blocking all traffic.
For posterity's sake, here is my working code:
when HTTP_REQUEST {
set refer_host [string tolower [HTTP::header Referer]]
if { ( not ($refer_host contains ".mydomain.com") ) and
( not ($refer_host contains ".myotherdomain.com") ) and
( [matchclass [string tolower [HTTP::path]] contains $::restricted_URL_datagroup] ) } {
Block content
HTTP::respond 404 content ""
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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