Reputation: 93348
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?
Upvotes: 2
Views: 236
Reputation: 127457
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).
Upvotes: 1
Reputation: 51819
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".
Upvotes: 2