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::uri] contains $::restricted_URL_datagroup]} {
Block content
HTTP::respond 404 content ""
}
}
But that blocked all the content, including when it is accessed from my site. So I tried this rule:
when HTTP_REQUEST {
if {[matchclass [HTTP::host] ends_with ".mysite.com"]} {
Do nothing
}
elseif {[matchclass [HTTP::uri] contains $::restricted_URL_datagroup]} {
Block content
HTTP::respond 404 content ""
}
}
And that effectively took my entire site down. What would be the proper way for me to write this rule?
- The_Bhattman
Nimbostratus
What is contained within ::restricted_URL_datagroup? - OviShare_69630
Nimbostratus
Something like "/dir/my_content.jpg" - The_Bhattman
Nimbostratus
What aboutwhen HTTP_REQUEST { if {[matchclass [HTTP::uri] ends_with $::restricted_URL_datagroup]} { discard } }
- OviShare_69630
Nimbostratus
If I understand the discard statement correctly, that would also block all access to the content even when it is accessed from within my site. I need to make an exception (i.e. ignore the rule) for all content accessed from within my site. - OviShare_69630
Nimbostratus
This is really confusing to me. I tried this rule: - The_Bhattman
Nimbostratus
Try something simple firstwhen HTTP_REQUEST { if {[HTTP::uri] ends_with "/dir/my_content.jpg" } { discard } }
- tarsier_90410
Nimbostratus
OviShare, if I understand your initial question correctly, you want the script to allow access to some paths on your application server but not all. Is that correct? - tarsier_90410
Nimbostratus
OviShare, if I understand your initial question correctly, you want the script to allow access to some paths on your application server but not all. Is that correct? - tarsier_90410
Nimbostratus
OviShare, if I understand your initial question correctly, you want the script to allow access to some paths on your application server but not all. Is that correct? - OviShare_69630
Nimbostratus
I figured out my problem. This code:
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