Forum Discussion
greenasp_41938
Nimbostratus
Jun 19, 2013bypass a splash page for certain IP addresses
I would like to change the iRule below to replace the "when HTTP_request" with the "when CLIENT_ACCEPTED" section of the irule. However, I get an error when i do. I am trying to allow certain IP ad...
nitass
Employee
Jun 20, 2013i see. you cannot use HTTP:: in CLIENT_ACCEPTED event. so, you have to collect and parse tcp payload yourself.
e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
destination 172.28.19.252:80
ip protocol 6
rules myrule
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when CLIENT_ACCEPTED priority 100 {
if { ![IP::addr [IP::client_addr] equals 192.0.0.0/8] } {
pool foo
event disable all
} else {
TCP::collect
}
}
when CLIENT_DATA {
if { [scan [TCP::payload] {GET %s HTTP/1.[01]} obj] == 1 } {
switch -glob $obj {
"/*.gif" {
set resp "HTTP/1.0 200 OK\r\nContent-Type: image/gif\r\n\r\n[b64decode [class match -value $obj equals images_class]]"
set resp_bin [binary format a* $resp]
TCP::respond $resp_bin
}
default {
TCP::respond "HTTP/1.0 200 OK"
}
}
TCP::close
}
}
}
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