Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the name of an HTTP status code matter

Say I'm sending some HTTP status code in PHP, do I actually need to do

header('HTTP/1.1 301 Moved Permanently');

or is it enough to

header('HTTP/1.1 301 FooBar');

I once did this in a quick and dirty reverse proxy, where I could only get the code, not the message, from a CURL response and sent it back with FooBar as message. This appeared to work fine.

like image 902
Bart van Heukelom Avatar asked Sep 02 '11 08:09

Bart van Heukelom


1 Answers

Via the spec:

The individual values of the numeric status codes defined for HTTP/1.1, and an example set of corresponding Reason-Phrase's, are presented below. The reason phrases listed here are only recommendations -- they MAY be replaced by local equivalents without affecting the protocol.

like image 98
Edward Dale Avatar answered Nov 12 '22 13:11

Edward Dale