Forum Discussion
hoolio
Cirrostratus
Nov 24, 2008Evaluate command only at runtime--not RULE_INIT?
Hi there,
I'd like to set a variable in RULE_INIT which contains the command HTTP::host and then have it evaluated at runtime in HTTP_REQUEST:
when RULE_INIT {
set ::htm...
hoolio
Cirrostratus
Nov 24, 2008Nevermind... escaping the braces of [HTTP::host] and [HTTP::uri] in RULE_INIT and then using subst in HTTP_REQUEST works:
when RULE_INIT {
Trigger a meta-refresh every X seconds
set ::refresh_interval 30
HTML content containing meta-refresh to the same requested host/uri
set ::html_response_string "
Hi there
Meta-refresh to http://\[HTTP::host\]\[HTTP::uri\] in $::refresh_interval seconds
"
}
when HTTP_REQUEST {
if {[HTTP::path] starts_with "/meta"}{
log local0. "response string: [subst $::html_response_string]"
HTTP::respond 200 content [subst $::html_response_string]
} else {
HTTP::respond 200 content "\r\n200\tClient IP:port: [IP::client_addr]:[TCP::client_port]\
-> VIP IP:port: [IP::local_addr]:[TCP::local_port]\r\n"
}
}
Aaron
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
