HTTP response response
Is it possible to return a different text in the response header than the regular rate?
For example, if the request is not valid, can I answer:
HTTP/1.1 400 Here be Dragons
And are these proxy headers and so on handled correctly?
+2
Allain lalonde
source
to share
2 answers
Yes, it conforms to the HTTP protocol to have arbitrary text in the response line. No, the proxy is not required to forward this as is (but it usually will).
+1
Martin v. LΓΆwis
source
to share
The HTTP spec says:
The status code is for machine use and the reason-phrase is for the user. The client is not required to validate or display the phrase reason.
and
The reason phrases provided here are guidelines only - they MAY be replaced with local equivalents without affecting the protocol.
So yes, it is valid to use whatever text you need as the "Status" mind markup code or "State name".
+2
Avi flax
source
to share