Forum Discussion
Mike_Wethington
Nimbostratus
Oct 08, 2007Redirecting HTTPS traffic to HTTP
I need to redirect HTTPS traffic to HTTP and only for a specific user agent using a 301 and preserving the URI. Can anyone help?
Deb_Allen_18
Nov 19, 2007Historic F5 Account
Hi maynard -
For the iRules Editor question, you should see if your question has already been addressed in that forum or post a new one if not: Click here
As for your iRule, you can use a couple of class lists to clean this up quite a bit (I changed the order of a few things, so you'll want to review for accuracy):
when HTTP_REQUEST {
if { [HTTP::header "User-Agent"] contains "maynard" } {
let test traffic in always
pool RD
} elseif { [HTTP::header "host"] starts_with "physicianreports.com" } {
send permanent redirect to FQDN for this site only
HTTP::respond 301 "Location" "http://www.physicianreports.com[HTTP::uri]"
} elseif { [IP::addr [IP::client_addr] equals $::rejectAddrs] } {
discard all requests originating from the addresses in the specified list
discard
} elseif { [HTTP::header "User-Agent"] contains $::bot_poolAgents) || \
([IP::addr [IP::client_addr] equals $::bot_poolAddrs)}{
send all bots on the list to the bot pool
pool bot_pool
} elseif { [HTTP::uri] contains "ppgreports" } {
send specific URIs to the appropriate pool
pool ppgreports
} elseif { [HTTP::uri] contains "/images" } {
send specific URIs to the appropriate pool
pool Media
} elseif { [HTTP::uri] contains $::ConsumerURIs } {
send URIs in the list to the Consumer pool
pool Consumer
} else {
pool http_cluster1
}
}The rule will need the following 4 classes defined:class bot_poolAgents {
type string
"ScanAlert"
"Slurp"
"GoogleBot"
"msnbot"
"Becomebot"
"Exabot"
"psbot"
"Verizon Superpages Web Crawler"
"Voilabot"
"Infocrawler-bot"
"Nutch"
"Baiduspider"
"ContextAd Bot"
"SpiderThread"
"Gigabot"
"Wotbox"
"Girafabot"
"NaverBot"
"Jetbot"
"WISEnutbot"
"Fast Enterprise Crawler"
"NLCrawler"
"ZiggsBot"
"ConveraCrawler"
"NimbleCrawler"
"FAST-Webcrawler"
"MSIECrawler"
"ichiro"
"IRLbot"
"accoona"
"TurnitinBot"
"genieBot"
"majestic12"
"sp.ask.com"
"Fetch API Request"
"Ask Jeeves/Teoma"
"Healthbot"
"TencentTraveler"
"aipbot"
"OpenWebSpider"
"Help:Bot"
}class bot_poolAddrs {
type address
network 66.249.64.0/20
network 64.233.178.0/23
network 64.41.168.240/28
host 72.14.228.89
host 65.57.245.11
network 209.67.114.16/26
host 69.20.123.42
host 196.201.83.98
host 38.119.107.78
}class rejectAddrs {
type address
network 207.154.31.5/20
host 213.255.196.85
}class ConsumerURIs {
type string
"/ajax"
"www.physicianreports.com"
"/health-management-tools"
"/local-doctors-directory"
"/doctors-directory"
"dsp_ad_block.cfm"
"consumer"
"directory_search"
"/directory"
}HTH
/deb
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