Hello,
I’m working with AFLEX to set some attribute to cookie response, like HttpOnly and Secure.
I’ve used Misha’s work with some customization: # aFlex per HttpOnly e Secure # Basato su script di Mischa Peters # A10 Networks. # include esclusione di cookie per CSFR
when RULE_INIT { set ::DEBUG 0 }
when HTTP_REQUEST { set PORT [TCP::local_port] }
when HTTP_RESPONSE { set current_time [TIME::clock seconds] foreach cookie_name [HTTP::cookie names] { if { [HTTP::cookie exists “$cookie_name”] } { set cookie_value [HTTP::cookie value “$cookie_name”] set cookie_expires [HTTP::cookie expires “$cookie_name”] set cookie_domain [HTTP::cookie domain “$cookie_name”] set cookie_path [HTTP::cookie path “$cookie_name”] set new_cookie “$cookie_name=$cookie_value” if { $cookie_expires > $current_time } { set new_expire [clock format $cookie_expires -format {%a, %d %b %Y %H:%M:%S GMT} -gmt 1] append new_cookie “; Expires=$new_expire” } if { $cookie_domain ne “” } { append new_cookie “; Domain=$cookie_domain” } if { $cookie_path ne “” } { append new_cookie “; Path=$cookie_path” } if { $PORT == 443 and $cookie_name ne “XSFR-TOKEN”} { append new_cookie “; Secure” } if { ($PORT == 80 or $PORT == 443) and $cookie_name ne “XSFR-TOKEN” } { append new_cookie “; HttpOnly” } if { ($::DEBUG == 1) } { log “Set-Cookie $new_cookie” } HTTP::cookie remove “$cookie_name” HTTP::header insert Set-Cookie “$new_cookie” } } }
it seems to work quite well but I can find failure in failure in the SLB AFLEX panel: HTTPONLY_AND_SECURE HTTP_RESPONSE 492 374 0
Looking in the showtech I was able to find this: Last 15 runtime errors per thread (event command error):
Thread 0:
Thread 1: 14(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 13(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 12(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 11(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 10(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 9(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 8(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 7(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 6(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 5(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 4(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 3(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 2(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 1(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 15(HTTP_RESPONSE, HTTP::cookie, incompatible cookie)
Thread 2: 9(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 8(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 7(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 6(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 5(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 4(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 3(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 2(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 1(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 15(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 14(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 13(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 12(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 11(HTTP_RESPONSE, HTTP::cookie, incompatible cookie) 10(HTTP_RESPONSE, HTTP::cookie, incompatible cookie)
But I was unable to find out which cookie is incompatible… Is there a way to debug this issue ?