views:

63

answers:

2

Is it valid to return different text in the response header than the usual fare?

For example if the request is invalid, could I respond with:

HTTP/1.1 400 Here be Dragons

And have that header properly handled by proxies, etc?

+1  A: 

Yes, it conforms to the HTTP protocol to have arbitrary text on the response line. No, proxies aren't required to forward that as-is (but typically will).

Martin v. Löwis
+2  A: 

The HTTP spec says:

The Status-Code is intended for use by automata and the Reason-Phrase is intended for the human user. The client is not required to examine or display the Reason-Phrase.

and:

The reason phrases listed here are only recommendations -- they MAY be replaced by local equivalents without affecting the protocol.

So yes, it's valid to use any text you'd like as the Reason-Phrase AKA "Status text" or "Status name".

Avi Flax