Forum Discussion
pedinopa_170325
Nimbostratus
Aug 29, 2017404 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...
Jad_Tabbara__J1
Cirrostratus
Aug 29, 2017Hello Pedinopa,
Try this
when HTTP_REQUEST {
set host [HTTP::host]
set path [HTTP::path]
switch $path {
"/PageNotFound" {
HTTP::respond 200 content [ifile get "PageNotFound_html"] "X-Frame-Options" "DENY" "X-XSS-Protection" "1; mode=block" "X-Content-Type-Options" "'nosniff'" "Connection" "Close"
}
}
}
when HTTP_RESPONSE {
if { [HTTP::status] eq "404" } {
HTTP::redirect "https://${host}/PageNotFound?url=${path}"
}
}
Please give a feedback
Hope it helps
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
