Forum Discussion
Andrea_Arquint
Oct 20, 2010Nimbostratus
cookie insertion
Hi
How can I set a cookie in the clients browser if he makes a request to a specific /folder/ ???
thanx
bb
Chris_Miller
Oct 20, 2010Altostratus
The wiki is your best friend...for this rule, we'll use subsets of the "HTTP::" command
http://devcentral.f5.com/wiki/default.aspx/iRules.HTTP
Here's a list of all the commands.
http://devcentral.f5.com/wiki/default.aspx/iRules.Commands
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/folder" } {
HTTP::cookie insert "name" value "value" } }
That rule will insert a cookie named "name" with a value of "value" whenever the URI requested contains "/folder" You might want to replace "contains" with "starts_with" depending on your requirements. You'll also want to add an expiration or path if you need it.
http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP__cookie.html shows all the options.
Let me know if you have any other questions.
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