Forum Discussion
iRule for redirecting the traffic of GoogleBot to a different pool using X-Header Value
We need to redirect Google Bots traffic to another Pool, What is the effective and simple iRule I can use to accomplish that ?
We can filter the traffic using X-Header Value, which is set to value "8" are good to redirect to a new pool.
Does Below iRule Work ?
when HTTP_REQUEST {
if { [matchclass [string tolower [HTTP::header X-forwarded-for]] equals 8] } {
pool A
}
pool default
}
OR
when HTTP_REQUEST {
if { [matchclass [string tolower [HTTP::header User-Agent]] contains googlebot] } {
pool A
}
pool default
}
3 Replies
Hi MohanK,
when HTTP_REQUEST { if { [HTTP::header X-Forwarded-For] equals "8" && [string tolower [HTTP::header User-Agent]] contains "googlebot" } { pool A } else { pool default } }- MohanK
Altostratus
Thank you for restructuring my iRule Eaa, I'll apply the above rule and let you know, if that works.
- JP_G
Altostratus
Hello All,
I am looking to refine the rule proposed above just a bit and came up with the following:
---
when HTTP_REQUEST {
if { [HTTP::header exists X-APP-WHITELIST] and [HTTP::header X-APP-WHITELIST] equals "8" or [string tolower [HTTP::header User-Agent]] contains "googlebot" } {
pool A
else {
pool default
}
}
---
We are looking for the detail: "X-APP-WHITELIST" in the header equal to "8" OR if the user-agent has, "googlebot" discovered in the header. Not looking at the XFF part of the header. The, '&&' appears to be a logical AND in which both conditions have to be true. We are looking for one or the other; does not have to be both.
Does this look to be simpler?
Thank you all for your replies.
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