pedinopa_170325
Aug 29, 2017Nimbostratus
404 irule with security headers
I am writting an irule to return a ifile (for a 404 error). In addition to returning the ifile (which does work) I want to insert security headers (this isnt working. How can I insert these headers
when HTTP_REQUEST { set host [HTTP::host] set path [HTTP::path] switch $path { "/PageNotFound" { HTTP::respond 200 content [ifile get "PageNotFound_html"] } } } when HTTP_RESPONSE {
if { [HTTP::status] eq "404" } { HTTP::redirect "https://${host}/PageNotFound?url=${path}" HTTP::header insert "X-Frame-Options" "DENY" HTTP::header insert "X-XSS-Protection" "1; mode=block" HTTP::header insert "X-Content-Type-Options" "'nosniff'" }
}