Forum Discussion

kridsana's avatar
Icon for Cirrocumulus rankCirrocumulus
Jun 16, 2021

iRule to secure flag on specific URL (Multiple URL in one VS)



We know that F5 can add secure attr in cookie from irule HTTP_RESPONSE <>

but this is apply to all website in virtual server!!


We have many URL in one virtual server. (Multi domain). ie and have the same Virtual server


Can we just add secure flag on cookie only when we access ? no need to add flag when we access URL-b


I think we need variable to check if http:host is URL-a or URL-b, but I don't know how to do it when this variable has to share on HTTP_REQUEST and HTTP_RESPONSE event on the same times.


Thank you

1 Reply

  • You may try below.

    when HTTP_REQUEST {
    set sflag 1
    if { [class match [HTTP::host] equals secure-flag-domains] } { set sflag 0 }
    when HTTP_RESPONSE {
        if { $sflag == 0} { 
        foreach mycookie [HTTP::cookie names] {
        HTTP::cookie secure $mycookie enable