Forum Discussion
HELITG_35878
Nimbostratus
Apr 16, 2008Help with blocking referers
We're migrating from a version 4 appliance to version 9. We maintain various sites behind our loadbalancers. We want to use block refers linking to our content.
I have a defined a classed based on the sites
class live_sites {
"www.site.com"
"www.site.co.uk"
"www.site.de"
"www.site.eu"
"www.site.fr"
}
Our 4.5 the rule worked.
The version 4.5.x rule we are trying to replicate is as follows:
rule live-sites {
if (http_host == one of live_sites) {
use pool live_pool
}
else {
discard
}
}
I'm having problems trying to achieve the same results in version 9.
when HTTP_REQUEST {
if { [matchclass http::host equals $::live_sites] } {
pool live_pool
}
else {
discard
}
}
Can anyone offer any assistance?
Thanks in advance.
- hoolio
Cirrostratus
If you want to validate that all requests have a host header value equal to the entries in your datagroup, the rule and datagroup you have listed should work. Just wrap the HTTP::host with square braces: [HTTP::host]. If you want to verify that the host header value value in the request contains one of the datagroup entries, you could change the "equals" to "contains". - HELITG_35878
Nimbostratus
Thanks Aaron, - hoolio
Cirrostratus
HTTP::host is case sensitive. Can you replace http::host with HTTP::host, and retest? - HELITG_35878
Nimbostratus
Thanks Aaron!
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