Forum Discussion

Georgi__Joe__St's avatar
Georgi__Joe__St
Icon for Altostratus rankAltostratus
Jul 21, 2016

Is it possible to remove "WWW-Authenticate" and "Connection" headers from HTTP::respond 401?

Hi All,

I am out of ideas regarding following issue. I have a response from backend servers with status code 200 and something as payload. I need to craft new response with status code 401 with same headers and different payload. Currently I am using HTTP::respond unfortunately it adds more headers than I need and I must remove them somehow (it is mandatory for me to not have them).

So is it possible to remove default headers from response when I call HTTP:respond?

 

HTTP::respond 401 content {top secret payload} noserver header1 header1 ....

 

I need to remove:

 

WWW-Authenticate: Basic realm=""
Connection: Keep-Alive

 

I also tried to workaround it with HTTP::payload, but can't find how to rewrite status code from 200 to 401

 

when HTTP_RESPONSE_DATA { 
    HTTP::payload replace 0 $content-lenght {top secret payload}
}  

 

Thank you in advance!