Forum Discussion

Mandragor's avatar
Mandragor
Icon for Altostratus rankAltostratus
Mar 21, 2018

Set HTTP Reponse status code to 451

By using an example in https://devcentral.f5.com/questions/changing-http-reponse-status-code I have tried to rewrite content from a Virtual Server that initially responds with a 200 to 451 instead;

 

when HTTP_RESPONSE {
    HTTP::collect [HTTP::header Content-Length]
}
when HTTP_RESPONSE_DATA {
HTTP::respond 451 -version 1.1 content [HTTP::payload] noserver
}

This fails in a browser, which will give a ERR_INVALID_RESPONSE error. The actual headers in the respons is:

 

HTTP/1.1 451 Unknown Code
Connection: Keep-Alive
Content-Length: 1444

Followed by the actual content. I suspect the issue here is that 451 is reported an unknown code, but should be standard according to RFC 7725?

 

1 Reply

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    This suggests two things:

     

    1. RFC7725 has not been implemented in F5, as there is a lack of a "Reason-Phrase" for code "451" in the status line;

       

    2. RFC7725 is not implemented by the browser, and what's more, the browser is in breach of HTTP protocol standards as it should handle the status code "451", which it does not understand, as if it were a "400".