Forum Discussion
Aug 04, 2010
How to set/detect/read cookies on the client machine
Hello All,
I am trying to set a cookie and detect it on the client machine, but am having issues detecting the cookie. My goal is to send credentials over SSL and go back to HTTP after it's been validated. A couple of questions.
1) To set a cookie on the client machine, IRules must set the cookie on the HTTP_Response event, correct?
ex)
if { not ([HTTP::cookie exists "NAME"]) } {
HTTP::cookie insert name "NAME" value "cookie exist"
}
2) To check if the cookie exist on the client machine I would have to check cookie on the HTTP_REQUEST event, correct?
if { ([HTTP::cookie exists "NAME"]) } {
// 301 redirect
}
3) Are the JSESSIONID cookies set on the server as well? If so where do they usually live? We are using WebSphere.
Any help/direction is fully appreciated.
Regards,
TRX
- hoolio
Cirrostratus
Hi Trx, - When you say "....client included a cookie in the request...", what do you mean exactly? Where would I check for cookies on the client machine? Or does the user have to send the cookie with the user's request?
- hoolio
Cirrostratus
You can check which cookies the client sends to LTM using an iRule which logs in HTTP_REQUEST:when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]" foreach cookie [HTTP::cookie names] { log local0. "[IP::client_addr]:[TCP::client_port]: Cookie $cookie = [HTTP::cookie value $cookie]" } }
- Thanks Aaron!
- Hello Aaron,
- hoolio
Cirrostratus
Hi TRX,
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