Forum Discussion
Kai_Wilke
Dec 15, 2015MVP
Hi kohli9harjeev,
your code looks good to me.
The error message will most likely occour if the current HTTP-request was "somehow" already responded by previous iRules. To check this behavior you could modify your code to...
when HTTP_RESPONSE {
set cookie_value [HTTP::header values "Set-Cookie"]
if { $cookie_value ne ""} then {
if { [catch {HTTP::payload replace 0 0 {}}] } then {
log -noname local0. "Warning: The HTTP request is already responded. So the next command will create an exception!"
}
HTTP::header remove "Set-Cookie"
foreach set_cookie_header $cookie_value {
HTTP::header insert "Set-Cookie" "${set_cookie_header};Secure;HttpOnly"
}
}
}
Cheers, Kai