The iRule above shows to be a valid iRule when I compile it in the F5 iRule Editor. (You should get that if you don’t already have it… it’s awesome). The iRule above should look at the cookies in the headers and if it cookies are not named cjj_INFO or CJJ_SESS then it will set the secure flag on the response. Just an FYI according to the documentation if you set the response flag to secure on a cookie that is already secure nothing will happen to the cookie. It will stay secure and will not be detrimental in any way.
Here is an iRule similar to the one above that might also work:
when HTTP_RESPONSE {
set mycookienames [HTTP::cookie names]
foreach cookie $mycookienames if !{ $mycookienames contains "cjj_INFO" or "cjj_SESS" } {
HTTP::cookie secure $mycookienames enable
}
}