Forum Discussion
Rory_Hewitt_139
Nimbostratus
Dec 27, 2013Can I include variables in an HTTP::respond string?
Is it possible to include variables in an HTTP::respond string?
For example:
set title "title of the page"
set body "Hi there!"
HTTP::respond 200 content "$title$body" "Set-Cookie" $cookie
or do I need to build the entire string in advance and then just pass it as a single content variable?
2 Replies
- Kevin_Stewart
Employee
You can absolutely include variables in the string.
- nitass
Employee
would it retain the spacing between the variables in the string?
yes
e.g.
[root@ve11a:Active:In Sync] config tmsh list ltm virtual bar ltm virtual bar { destination 172.28.20.15:80 ip-protocol tcp mask 255.255.255.255 profiles { http { } tcp { } } rules { myrule } source 0.0.0.0/0 vs-index 34 } [root@ve11a:Active:In Sync] config tmsh list ltm rule myrule ltm rule myrule { when HTTP_REQUEST { set var1 "12345" set var2 "abcdef" set var3 "xyz" HTTP::respond 200 content "$var1 $var2 $var3\r\n" } } [root@ve11a:Active:In Sync] config curl -i http://172.28.20.15 HTTP/1.0 200 OK Server: BigIP Connection: Keep-Alive Content-Length: 29 12345 abcdef xyz
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
