This client error response code indicates that the server cannot fulfill the requirements defined by the Expect
field in the request header.
Meaning
The server is unable to meet the expectation specified in the Expect
field of the request header. The most common scenario is when the server does not support or is unwilling to handle the “100-continue” expectation.
Expect Header
The Expect
header is used by the client to inform the server of a specific behavior it expects. The most commonly used value is “100-continue.”
Use Cases
- When the client wants to confirm that the server is willing to accept a request before sending a large amount of data.
- The server is unable or unwilling to process requests that include a specific
Expect
header due to policy restrictions.
Example Request
POST /upload HTTP/1.1
Host: example.com
Content-Type: application/json
Content-Length: 1000000
Expect: 100-continue
Possible Reasons
- The server does not support the “100-continue” mechanism.
- The server is temporarily unable to accept large file uploads due to load or other issues.
- Server configuration prohibits certain values of the
Expect
header.
Server Response
When the server cannot fulfill the requirements of the Expect
header, it returns a 417 status code, possibly including an explanatory message in the body.
Client Handling
Upon receiving a 417 response, the client may choose to:
- Remove the
Expect
header and resend the request. - Use a different method or protocol to complete the task.
- Report the error to the user, indicating that the server does not support the expected functionality.
Best Practices
- Servers should support common
Expect
values, especially “100-continue.” - Clients should have fallback strategies when using uncommon
Expect
values. - For large file uploads, using “100-continue” can help detect potential issues before sending the entire request body, saving bandwidth and time.
This status code is not commonly encountered in day-to-day web development but may arise when handling large file uploads or special protocol requirements.
Related 4xx error code
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 413 Payload Too Large
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 418 I’m a teapot
- 421 Misdirected Request
- 422 Unprocessable Entity (WebDAV)
- 423 Locked (WebDAV)
- 424 Failed Dependency (WebDAV)
- 425 Too Early
- 426 Upgrade Required
- 428 Precondition Required
- 429 Too Many Requests
- 431 Request Header Fields Too Large
- 451 Unavailable For Legal Reasons
- 499 Client Closed Request