Forum Discussion
Philipp_Stadler
Nimbostratus
Oct 09, 2013ASM::disable doesn't work
Hi all,
at the moment I'm a little bit embarrassed about disabling ASM from an irule.
My intent by this irule is to bypass ASM for specific pathes (/test1/ and /test2/) for specified IP addresses (...
David_Stout
Nimbostratus
Oct 09, 2013I don't think you need the "if {[HTTP::class asm]==1}{" statement as you are selecting the disabling against the disable_asm string being a value of 1 so the second if statement doesn't appear to be required.
We do the same thing but we don't use a datagroup for the URI list but just encode the lines directly into the iRule for the application and all under the HTTP_CLASS_SELECTED method. Example of the different ways we do this below.
when HTTP_CLASS_SELECTED {
if { [IP::addr [IP::client_addr]/32 equals 10.x.x.x] } {
ASM::disable
return
} elseif { [IP::addr [IP::client_addr]/26 equals 10.x.x.x] } {
ASM::disable
return
} else {
ASM::enable
}
if { [HTTP::header "User-Agent"] contains "Mozilla" } {
ASM::disable
return
}
set test_uri [string tolower [HTTP::uri]]
if { $test_uri contains "/rpc" } {
ASM::disable
return
} elseif { $test_uri contains "/owa" } {
ASM::disable
return
} elseif { $test_uri contains "/microsoft-server-activesync" } {
ASM::disable
return
} elseif { $test_uri contains "/ucm/cma/" } {
ASM::disable
return
} elseif { $test_uri contains "/preview.aspx" } {
ASM::disable
return
} else {
ASM::enable
}
switch -glob $test_uri {
"*.css" { set test_uri [string map {.css "" } $test_uri] }
"*.gif" { set test_uri [string map {.gif "" } $test_uri] }
"*.ico" { set test_uri [string map {.ico "" } $test_uri] }
"*.jpg" { set test_uri [string map {.jpg "" } $test_uri] }
"*.bmp" { set test_uri [string map {.bmp "" } $test_uri] }
"*.doc" { set test_uri [string map {.doc "" } $test_uri] }
"*.docx" { set test_uri [string map {.docx "" } $test_uri] }
"*.dot" { set test_uri [string map {.dot "" } $test_uri] }
"*.ico" { set test_uri [string map {.ico "" } $test_uri] }
"*.mp3" { set test_uri [string map {.mp3 "" } $test_uri] }
"*.pdf" { set test_uri [string map {.pdf "" } $test_uri] }
"*.png" { set test_uri [string map {.png "" } $test_uri] }
"*.pps" { set test_uri [string map {.pps "" } $test_uri] }
"*.ppsx" { set test_uri [string map {.ppsx "" } $test_uri] }
"*.ppt" { set test_uri [string map {.ppt "" } $test_uri] }
"*.pptx" { set test_uri [string map {.pptx "" } $test_uri] }
"*.swf" { set test_uri [string map {.swf "" } $test_uri] }
"*.vsd" { set test_uri [string map {.vsd "" } $test_uri] }
"*.wav" { set test_uri [string map {.wav "" } $test_uri] }
"*.wma" { set test_uri [string map {.wma "" } $test_uri] }
"*.xls" { set test_uri [string map {.xls "" } $test_uri] }
"*.xlsx" { set test_uri [string map {.xlsx "" } $test_uri] }
"*.zip" { set test_uri [string map {.zip "" } $test_uri] }
default {
return
}
}
Verify method is GET
if {not ([HTTP::method] eq "GET")}{
return
}
if { ([HTTP::method] eq "POST")}{
ASM::disable
return
}
}
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