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 ::html_content "Requested host was [HTTP::host]"
}
when HTTP_RESQUEST {
if {[HTTP::path] starts_with "/test"}{
HTTP::respond 200 content $::html_content
}
}
This example doesn't work as HTTP::host is evaluated in RULE_INIT--where the command isn't valid. I tried using eval and subst, but couldn't figure out any combination that would allow me to set the contents in RULE_INIT and force evaluation in HTTP_REQUEST.
Is there a way to only evaluate the command in HTTP_REQUEST?
I'd like to have the variable defined in RULE_INIT along with all other variables that the customer would potentially need to modify. I realize I could use a placeholder and then use string map in HTTP_REQUEST to replace it with the actual HTTP::host value, but that doesn't seem very elegant.
Thanks,
Aaron
1 Reply
Sort By
No RepliesBe the first to reply
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