Forum Discussion
JP_42120
Nimbostratus
Oct 18, 2012irule performance: combine multiple irules
Hi,
We have an several irules that we are trying simplify and combine for better performance.
first to block certain URI's
when HTTP_REQUEST {
switch [HTTP::uri] {
"...
What_Lies_Bene1
Cirrostratus
Oct 19, 2012And now I've reordered it a bit so if you redirect or respond with a 404 the iRule quits early. Regardless, I've a feeling nitass will come along and make it even better;
when HTTP_REQUEST {
if { switch [string tolower [HTTP::uri]] } {
"/proxy/" -
"/content/xmlmovies/undefined" -
"/duas/" {
HTTP::respond 404 content "404 - file not found."
return }
}
Redirect to certain URI's to HTTPs
if { [TCP::local_port] == 80 } {
switch -glob [string tolower [HTTP::path]] {
"/login*" -
"/app/login_user*" -
"/app/new*" -
"/app/associate_new*" -
"/account*" {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
return
}
}
}
To log request with certain content size
if { [HTTP::header Content-Length] >= 9000 } {
log local0. "[HTTP::header Content-Length] byte [HTTP::method] request from [IP::client_addr] for [HTTP::host][HTTP::uri]"
}
}
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