e.g.
config
[root@ve11a:Active:In Sync] config tmsh list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 32
}
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] ends_with ".xml" } {
set add_header 1
} else {
set add_header 0
}
}
when HTTP_RESPONSE {
if { $add_header } {
HTTP::header insert "X-Robots-Tag" "noindex"
}
}
}
test
[root@ve11a:Active:In Sync] config curl -I http://172.28.24.10/1.html
HTTP/1.1 404 Not Found
Date: Mon, 26 May 2014 14:48:02 GMT
Server: Apache/2.2.3 (CentOS)
Content-Type: text/html; charset=iso-8859-1
[root@ve11a:Active:In Sync] config curl -I http://172.28.24.10/1.xml
HTTP/1.1 404 Not Found
Date: Mon, 26 May 2014 14:48:06 GMT
Server: Apache/2.2.3 (CentOS)
Content-Type: text/html; charset=iso-8859-1
X-Robots-Tag: noindex