Forum Discussion
Insert custom Cookie on response with APM portal access resource
Hi All,
I have a situation where we need to insert a custom cookie (any name,value) for client browser to store. Need to set this cookie for a web application published using APM portal access resource.
I have tried various events in an iRule, tried HTTP_REQUEST and HTTP_RESPONSE combination and tried HTTP::header insert set-cookie as well as HTTP::cookie insert.
I also tried REWRITE_REQUEST_DONE to insert cookie on the client side.
I previously had to do the same on the server side which i did using ACCESS_ACL_ALLOWED successfully. I am wondering if this can be done now??
In LTM+APM mode this iRule and its correct variants work as expected i see the cookie being set and stored in browser but in portal access resource i only see set-cookie or cookie insert commands in logs but nothing in the browser.
Below is one version of the code i tried, please can someone help and advise? or had a previous experience with similar situation?
when HTTP_REQUEST { set isset [HTTP::cookie exists {MyCookie}]
}
when HTTP_RESPONSE { if {$isset == 0} { HTTP::cookie insert name MyCookie value One domain "mycompany.com" path "/"
foreach cookie [HTTP::cookie names] { HTTP::cookie secure $cookie enable }
} }
- iaineNacreous
Hi
Try this
when REWRITE_REQUEST_DONE { Need something to signify that the right portal object is being called if {[HTTP::host] equals "www.example.com" } { set match 1 } } when HTTP_RESPONSE_RELEASE { if { [info exists match] } { HTTP::cookie insert name MyCookie value "One; Secure;" }
}
This code would need to be associated to the VIP hosting the APM profile that hosts the WebTop.
Recent Discussions
Related Content
* 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