Forum Discussion
kraysco_322584
Nimbostratus
Jun 02, 2017iRule - command is not valid in the current event context - cookie management
I am attempting to write an iRule that checks a cookie on HTTP_REQUEST and then writes a cookie on HTTP_RESPONSE in order to control the display of a banner message: when CLIENT_ACCEPTED {
s...
cjunior
Nacreous
Jun 02, 2017The command is on wrong layer place.
I have not tested, but I think it will work:
when RULE_INIT {
set static::notification_page {
... HTML Notification Page - code omitted ...
}
}
when HTTP_REQUEST {
set ckname NotificationDone
set ckvalue 1
set ckdomain ".[HTTP::host]"
if { (not [HTTP::cookie exists $ckname]) } {
HTTP::respond 200 content [subst $static::notification_page] Mime-Type "text/html"
}
}
when HTTP_RESPONSE {
if { (not [HTTP::cookie exists $ckname]) } {
HTTP::cookie insert name $ckname value $ckvalue path / domain $ckdomain
HTTP::cookie expires $ckname 120
}
}
Regards.
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
