417 Expectation Failed
A server emits 417 Expecation Failed
when it encountered a Expect
header that it didn’t understand or doesn’t support.
A client can use the Expect
header to tell the server that it requires a
certain behavior from a server.
The only expectation that (as far as I know) is standardized, is
100-continue
.
This looks like this:
POST /foo/bar HTTP/1.1
Content-Type: application/gzip
Content-Length: 12345678765
Expect: 100-continue
...
This request intends to upload a large file. The client tells the server that
it expects the server to first respond with a 100 Continue
response.
If a server supports this, it will first return this 100 Continue
response,
which tells a client that the request was understood, supported and probably
acceptable and it can continue uploading.
If the server did not support this feature, it must response with 417
:
HTTP/1.1 417 Expectation Failed
Content-Type: text/plain
We don't support 100-continue
If a server sees a different type of expectation that’s a new future standard,
or some custom extension it should always return 417
.
References
- RFC7231, Section 6.5.14 - 417 Expectation Failed
- RFC7231, Section 6.2.1 - 100 Contnue
- RFC7231, Section 5.1.1 - Expect header