error code 417

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 Expect header
  • API gateway restrictions
  • Old web servers
  • Misconfigured load balancers
  • HTTP client library issue Fixes
  1. Remove the Expect header cURL

bash id=”e7r2md”
curl -H “Expect:” https://example.com

  1. Node.js example

js id=”9p3dva”
const options = {
headers: {
Expect: ”
}
};

  1. PHP example

php id=”u6n2xa”
curl_setopt($ch, CURLOPT_HTTPHEADER, [‘Expect:’]);

  1. Axios example

js id=”g8z2qw”
axios.post(url, data, {
headers: {
Expect: ”
}
});

Related status codes

  • 100 → Continue
  • 400 → Bad Request
  • 411 → Length Required
  • 413 → Payload Too Large
  • 415 → Unsupported Media Type
  • 429 → Too Many Requests