Alex S
Alex S

Reputation: 26051

Text in HTTP headers

Is there any rule against sending an alternate text for an HTTP response error? For example, a default is HTTP/1.1 400 Bad Request. When sending a header I set myself is it legal to do something like HTTP/1.1 400 Epic Fail?

Upvotes: 3

Views: 426

Answers (2)

Kornel
Kornel

Reputation: 100100

It's fine. You can put any text there. You can even use special characters as long as you stick to ISO-8859-1 encoding.

From the RFC:

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

Upvotes: 4

Martin v. Löwis
Martin v. Löwis

Reputation: 127447

That's perfectly legal. Clients should only care about the error code, although they may chose to render the status text to the user (most often, they render the body of the response instead).

Upvotes: 1

Related Questions