We recently migrated from the Physical F5 to the virtual edition. Most of the transition went well. We have an iRule that will pull the SAML information and then create a cookie that is used by an application for access. The cookie when it is displayed by the Web browser should have single quotes around the information, such as Cookie_name “cookie_info” Now that we switched over to the Virtual edition F5 the cookie has double quotes such as Cookie_name ““cookie_info”” I need to remove the extra quotes. It has been suggested that I use the string trim command, however I am new to iRule writing and am not sure how I would say to the system to remove the quotes from the cookie. Could someone please give me some guidance on how to remove the quotes?
Thanks
Please post your iRule (the cookie related sections) to this forum. This will help us to understand where the double-quotes are comming from and allows us to finally propose a workaround…
Cheers, Kai
Note: The TCL [string trim $input “\”“] command is not able to remove a single quote. It willremove every leading and trailing quotes. The TCL [string map {”\“\”" “\”" } $input] command may be used instead to simply replace double quotes with single quotes.
Cheers, Kai
the sample section is catch { if { [ACCESS::session data get session.saml.last.result] == “1” && [ACCESS::session data get session.saml.last.name.test] != “” && [ACCESS::session data get session.last.attr.name.sample] != “” && $attributes != “”} { HTTP::cookie insert name “monster” value “session=$session :: user=$user :: Org=$test :: secOrg= :: whoami=$name” path “/” }
When the monster cookie is created it is surrounded by ““cookie”” I need to remove the second set of quotes.
Hi Paul,
the iRule snipped looks valid for me and should not wrap the cookie value in double quotes. Which iRule event are you using for this iRule so that I can verify your observations?
As a workaround you could also switch to a
[HTTP::header insert]
syntax to issue the cookie…
HTTP::header insert "Set-Cookie" "monster=\"session=$session :: user=$user :: Org=$test :: secOrg= :: whoami=$name\"; Path=/"
Cheers, Kai
Thank you for the suggestion. At this time I am not using anything to check the irule. I am open to suggestions. As I am always willing to learn more and more about the F5 and iRules.
Did my previous answer solved your problem?
Cheers, Kai
Sir unfortunately it did not, I am getting the same results.
I was able to glean more information on the problem. When I move the virtual server from the Physical F5 which is version 11 to the Virtual F5 which is version 12 and I try to access the program, the cookie has single quotes around it when using IE and double quotes around it when using firefox. I also saw that he cookie was created several times when the program was moved to the new F5 verses one time when in the old Physical F5. I have gone through the configuration and did not see anything. The major difference between the Old physical F5 and the new virtual F5 is that on the new F5 we have turned on the ASM module. Would it be possible for that to be causing these strange behaviors?
Thanks Paul
Hi Paul,
I would recommend to rule out the differences in browsers by just looking at the wire with tools like Fiddler or HTTPWatch. Your F5 will send it always the same way regardless of the used browser. If this format is correct but somehow a specific browser will double-quote the value it would be a fault of the browser then…
So if possible post the complete HTTP-Response where the Cookie is send to the client and wildcard/remove as little sensitive information as possible.
Cheers, Kai
I will work on this. Thanks
One new observation. when I access the website using IE the cookie is surrounded buy a single quote, however when I access the same page using Firefox the cookie is surrounded by double quotes. Curious.
What would help me greatly is how do I strip of the extra quotes around the cookies. Does anyone have any suggestions on how to do this? Thanks
No matter what I have attempted when the cookie is sent to the web browser, whether it be Firefox or IE a set of double quotes is added to the cookie. As a part of troubleshooting I created a cookie that did not have any spaces and when I view the cookie in the browser there is not an additional set of double quotes added. Is there a way that I can write the iRule so that spaces are expected as a part of the iRule?