Forum Discussion
Rusty_Hale_8009
Nimbostratus
Apr 26, 2005Grab value out of cookie and store it in a header variable
I have information that resides in a cookie:
JetNetUser=XXXXXXXX
I want to grab this information out of the cookie and insert it into the http header and store the value (XXXXXXXX) into a variable called
auth-user
What would the syntax be to do this?
Thanks in advance for your help.
2 Replies
- unRuleY_95363Historic F5 Account
when HTTP_REQUEST { set auth_user [HTTP::cookie JetNetUser] HTTP::header insert JetNetUser $auth_user }
It might be wise to avoid the hyphen character in a variable name as it makes referencing it a bit more cumbersome (you need to always enclose it in braces, eg ${auth-user}). I used the underscore character instead in the above example. - JRahm
Admin
I understood the question to mean that JetNetUser was part of the cookie. If that's the case, trywhen HTTP_REQUEST { set auth_user [findstr [HTTP::cookie ] "JetNetUser" 11 "&" ] HTTP::header insert $auth_user }
I'm assuming here the terminator of your string will be &, so you'll need to change this if it's not.
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
