Forum Discussion
Vincent_Ciccia_
Nimbostratus
Jun 10, 2009Help with modyfying Set-Cookie header
I would like to load Set-Cookie values into an array. I want to manipulate one of the cookies (JSESSIONID) and then reinsert all the headers back.
The command HTTP::header values "Set-Cookie" command returned this (as an example):
{MYSAPSSO2=AjExMDAgAA5wb3J0YWw6VkNJQ0NJQYgAE2Jhc2ljYXV0aGVudGljYX
Rpb24BAAdWQ0lDQ0lBAgADMDAwAwADSkQxBAAMMjAwOTA2MTAxOTU3BQAEAAAACAoAB1ZDSUNDSUH%2FAPcwgfQGCSqGSIb3DQEHAqCB5jCB4wIBATELMAkGBSsOAwIaBQAwCwYJKoZIhvcNAQcBMYHDMIHAA
gEBMBYwDjEMMAoGA1UEAxMDSkQxAgRyHEiTMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wOTA2MTAxOTU3MzVaMCMGCSqGSIb3DQEJBDEWBBThLPje3q
A4wlEbWBDsgU2FQYBQ4TAJBgcqhkjOOAQDBC4wLAIUP!VkqPapUgGJ1bRzLDcevgT8jVkCFGrn!fIdQPf63ZbkXXZAy26RCNrK;path=/;domain=.company.com;HttpOnly} {PortalAlias=port
al; Path=/} {saplb_*=(J2EE13223700)13223750; Version=1; HttpOnly} {JSESSIONID=(J2EE13223700)ID1690302250DB11227503842825842299End; Version=1; Domain=espporta
lqa.company.com; HttpOnly}
Is there an example of how to parse that string and load the cookies into an array? I've searched and have not found anything.
My issue is I'm running v9.3.1. I only want to manipulate/remove/reinsert the JSESSIONID cookie, but when I do a HTTP::header remove it removes ALL of the headers with the same name (Set-Cookie). So I think I'm forced to parse out the cookies, load the contents into an array, remove all the Set-Cookie headers, and then using a loop reinsert them using the values of the array... with something like this:
for {set j 0} {$j < [array size set_cookies]} {incr j}{
HTTP::header insert "Set-Cookie" $set_cookies($j)
}
Any suggestions?
Thank you!
- jeff_mccombs_47
Nimbostratus
Check the HTTP::cookie commands to see if these can help. http://devcentral.f5.com/Wiki/default.aspx/iRules.HTTP__cookie
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