HTTP Status Code 417 = “Expectation Failed”
The server could not meet the requirements specified in the request’s Expect header.
Most common cause
The client sends:
http id=”h2d8ke”
Expect: 100-continue
but the server:
- does not support it,
- rejects it,
- or cannot fulfill the expectation. Example flow
Client request
http id=”r4d7mv”
POST /upload HTTP/1.1
Host: example.com
Expect: 100-continue
Content-Length: 999999
Server response
http id=”t7e3ac”
HTTP/1.1 417 Expectation Failed
Why Expect: 100-continue exists
It allows the client to ask:
“Should I send the large request body?”
This avoids uploading huge files if the server will reject them anyway.
Common reasons for 417
- Proxy/server incompatibility
- Unsupported
Expectheader - API gateway restrictions
- Old web servers
- Misconfigured load balancers
- HTTP client library issue Fixes
- Remove the
Expectheader cURL
bash id=”e7r2md”
curl -H “Expect:” https://example.com
- Node.js example
js id=”9p3dva”
const options = {
headers: {
Expect: ”
}
};
- PHP example
php id=”u6n2xa”
curl_setopt($ch, CURLOPT_HTTPHEADER, [‘Expect:’]);
- Axios example
js id=”g8z2qw”
axios.post(url, data, {
headers: {
Expect: ”
}
});
Related status codes
100→ Continue400→ Bad Request411→ Length Required413→ Payload Too Large415→ Unsupported Media Type429→ Too Many Requests