gurrish_132043
Sep 17, 2013Nimbostratus
Problem with HTTP::respond, get rid of WWW-Authenticate header
Hi! Im trying to do this generic error page to display for 4XX and 5XX responses with the help from an iRule. This is what I did.
when HTTP_RESPONSE {
set DEBUG 0
if { $DEBUG } { log local0.debug "client_addr:[IP::client_addr] | cn:$cn | uid:$uid | serial:$serial | market:$market | uuid:$uuid | status:[HTTP::status] | method:$method | uri:$uri" }
HTTP::header insert "Strict-Transport-Security" "max-age=16070400; includeSubDomains"
switch -glob [HTTP::status] {
"4*" {
if { $DEBUG } { log local0.debug "masking 4XX error" }
HTTP::respond [HTTP::status] content "<!doctype html><html><head><title>[HTTP::status]</title></head><body><div style=\"margin-left: 20px ; font-family: Arial,Helvetica,Verdana; font-size:100px; color: f0f0f0;\">[HTTP::status]</div></body></html>"
}
"5*" {
if { $DEBUG } { log local0.debug "masking 5XX error" }
HTTP::respond [HTTP::status] content "<!doctype html><html><head><title>[HTTP::status]</title></head><body><div style=\"margin-left: 20px ; font-family: Arial,Helvetica,Verdana; font-size:100px; color: f0f0f0;\">[HTTP::status]</div></body></html>"
}
default {
if { $DEBUG } { log local0.debug "OK status returned" }
Do nothing but returning the response
}
}
}
But now i have this problem, that everytime that a 401 is returned i.e "HTTP::respond 401", the header WWW-authenticate is returned which results in the stupid basic authentication login box is being displayed in the users browser. Not such a great scenario... since there is nothing to authenticate against. Does anyone know how to get rid of this? I have tried to remove the header with "HTTP::header remove WWW-Authenticate", doesn't work...