Forum Discussion

pedinopa_170325's avatar
pedinopa_170325
Icon for Nimbostratus rankNimbostratus
Aug 25, 2017

x-frame-options

I have had to do multiple irules to set different x-frame-options. So I have multiple irules setting x-frame-options, I want to write 1 irule that will pick the appropriate x-frame-option based on the host name that is returned. I have been working on the irule below but it doesnt seem to insert the header and causes my site not to be accessible when applied to the VS. The sites are SSL so can I not check the HTTP::host should I be grabbing the host another way?

 

when HTTP_REQUEST { set host [string tolower [HTTP::host]]

 

}

 

when HTTP_RESPONSE { if {[$host eq ";]} { HTTP::header insert X-Frame-Options "ALLOW-FROM ;

 

} else { HTTP::header replace X-Frame-Options "DENY" }

 

}

 

1 Reply

  • I found the solution with Data Groups.

     

    when HTTP_REQUEST { set host [string tolower [HTTP::host] } when HTTP_RESPONSE { if {[class match $host contains URLdatagroup]} { HTTP::header replace X-Frame-Options "ALLOW-FROM ; } else { HTTP::header replace X-Frame-Options "ALLOW-FROM ; }

     

    }