Forum Discussion
Deon
Oct 14, 2011Nimbostratus
Multiple iRule Redirects, event disable, TCP::close
We have multiple iRules and each can do a redirect based on a condition in HTTP_REQUEST event. I added an event disable after the redirect in each iRule so that I don't have multiple redirects happen...
nitass
Oct 15, 2011Employee
What you can do is a "return" to escape the event from further processing.i understand return does not stop processing other event.
What is the downside of the following with the TCP::close added?i do not see any downside except client has to create a new tcp connection.
[root@iris:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.17.33:http
ip protocol tcp
rules {
myrule
myrule2
}
profiles {
http {}
tcp {}
}
}
[root@iris:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST priority 100 {
if {[HTTP::uri] equals "/"} {
HTTP::redirect "http://172.28.17.33/myapproot"
TCP::close
event disable
}
log local0. "client [IP::remote_addr]:[TCP::remote_port], uri [HTTP::uri]"
}
}
[root@iris:Active] config b rule myrule2 list
rule myrule2 {
when HTTP_REQUEST {
log local0. "client [IP::remote_addr]:[TCP::remote_port], uri [HTTP::uri]"
}
}
[root@iris:Active] config tail -f /var/log/ltm
Oct 15 16:47:58 local/tmm info tmm[4601]: Rule myrule : client 192.168.206.102:62770, uri /
since redirect was sent on existing tcp connection, http event was not triggered.
[root@iris:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST priority 100 {
if {[HTTP::uri] equals "/"} {
HTTP::redirect "http://172.28.17.33/myapproot"
TCP::close
event disable
}
log local0. "client [IP::remote_addr]:[TCP::remote_port], uri [HTTP::uri]"
}
}
[root@iris:Active] config tail -f /var/log/ltm
Oct 15 17:09:48 local/tmm info tmm[4601]: Rule myrule : client 192.168.206.102:62848, uri /
Oct 15 17:09:48 local/tmm info tmm[4601]: Rule myrule2 : client 192.168.206.102:62848, uri /
Oct 15 17:09:48 local/tmm info tmm[4601]: Rule myrule : client 192.168.206.102:62849, uri /myapproot
Oct 15 17:09:48 local/tmm info tmm[4601]: Rule myrule2 : client 192.168.206.102:62849, uri /myapproot
[root@iris:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST priority 100 {
if {[HTTP::uri] equals "/"} {
HTTP::redirect "http://172.28.17.33/myapproot"
TCP::close
event disable
}
log local0. "client [IP::remote_addr]:[TCP::remote_port], uri [HTTP::uri]"
}
}
[root@iris:Active] config tail -f /var/log/ltm
Oct 15 17:11:40 local/tmm info tmm[4601]: Rule myrule : client 192.168.206.102:62860, uri /
Oct 15 17:11:40 local/tmm info tmm[4601]: Rule myrule : client 192.168.206.102:62861, uri /myapproot
Oct 15 17:11:40 local/tmm info tmm[4601]: Rule myrule2 : client 192.168.206.102:62861, uri /myapproot
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