
here’s some sample code:
when HTTP_REQUEST {
code1
asdfasdf
code2
HTTP::respond 200 content "Hi!"
event all disable
return
}
What do you think about this linky?
my comment doesn’t save newlines tester
this is a test
new line test
1 2 3
1 2
what about triple quote
As Kevin said, this certainly is possible: Here’s an example from the HTTP::collect wiki page. You can also check the HTTP::payload wiki page for more info on doing the payload replacement: DevCentral - An F5 Technical Community DevCentral - An F5 Technical Community
From https://devcentral.f5.com/wiki/iRules.http__collect.ashx
Collect a request payload
when HTTP_REQUEST {
if {[HTTP::method] eq "POST"}{
Trigger collection for up to 1MB of data
if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576}{
set content_length [HTTP::header "Content-Length"]
} else {
set content_length 1048576
}
Check if $content_length is not set to 0
if { $content_length > 0} {
HTTP::collect $content_length
}
}
}
when HTTP_REQUEST_DATA {
do stuff with the payload
set payload [HTTP::payload]
}
why no new lines ![]()
code with tabs…
line1
tab_line2
lin3
tab_line4
Longer code example with tabs
when CLIENT_ACCEPTED {
log local0. "[IP::client_addr]:[TCP::client_port]: Connected=[IP::local_addr]:[TCP::client_port] [virtual name]"
}
when LB_SELECTED {
if {[IP::addr [LB::server addr] equals 8.8.8.8] } {
snat 6.6.6.6
log local0. "[IP::client_addr]:[TCP::client_port]: Selected=[LB::server], SNAT=[LB::snat], matched=8.8.8.8"
} else {
snat automap
log local0. "[IP::client_addr]:[TCP::client_port]: Selected=[LB::server], SNAT=[LB::snat]
}
}
Aaron
more…
when HTTP_REQUEST {
switch -glob [HTTP::path] {
"/case1" -
"/case2" -
"/case3" -
"/case4" {
matched
}
default {
switch [HTTP::host] {
"host1" {
matched 1
}
default {
matched 2
}
}
}
}
}
Aaron
Multi- line Woo hoo!