Forum Discussion
John45_41805
Nov 10, 2011Nimbostratus
Using if HTTP::header value Content-Type contains "text"
When I choose something as my content type...lets call it ..johnsname
do i have to define johnsname in the F5 or assuming I know my header info it will be detected by the F5 automatically a...
nitass
Nov 10, 2011Employee
e.g.
[root@ve1023:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.65.152:http
ip protocol tcp
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if {[HTTP::header value johnsname] equals "default"} {
log local0. "it is default"
} else {
log local0. "it is not default"
}
}
}
[root@ve1023:Active] config curl -I http://172.28.65.152/ -H "johnsname: default"
HTTP/1.1 200 OK
Date: Thu, 10 Nov 2011 16:31:32 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Tue, 08 Nov 2011 12:54:37 GMT
ETag: "4183c9-30-ac7cfd40"
Accept-Ranges: bytes
Content-Length: 48
Connection: close
Content-Type: text/html; charset=UTF-8
[root@ve1023:Active] config curl -I http://172.28.65.152/ -H "johnsname: test"
HTTP/1.1 200 OK
Date: Thu, 10 Nov 2011 16:31:39 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Tue, 08 Nov 2011 12:54:37 GMT
ETag: "4183c9-30-ac7cfd40"
Accept-Ranges: bytes
Content-Length: 48
Connection: close
Content-Type: text/html; charset=UTF-8
[root@ve1023:Active] config tail /var/log/ltm
Nov 10 08:31:18 local/tmm info tmm[4766]: Rule myrule : it is default
Nov 10 08:31:24 local/tmm info tmm[4766]: Rule myrule : it is not default
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