417 Expectation Failed
4xx client error
The server can't meet the requirement in the request's Expect header.
417 is the 'no' to an Expect header. In practice the only expectation in use is Expect: 100-continue, and some servers and proxies that don't support it answer 417 instead of ignoring it.
| Class | 4xx Client Error |
|---|---|
| Retry? | No — change the request first |
| Cacheable by default | No — only with explicit Cache-Control |
| Response body | Allowed |
| Defined in | RFC 9110 §15.5.18 — 417 Expectation Failed |
Example response
HTTP/1.1 417 Expectation Failed
Content-Type: application/json
Content-Length: 30
{"error":"Expectation Failed"}Common causes
- A client sent
Expect: 100-continueto a server or proxy that rejects it. - Older .NET
HttpWebRequestclients send that header by default.
How to fix it
- Disable the header:
curl -H 'Expect:', orServicePointManager.Expect100Continue = falsein older .NET. - Upgrade the proxy or server to one that handles 100-continue.
Send a 417 from your server
Express
res.status(417).json({ error: "Expectation Failed" });Next.js route handler
return Response.json({ error: "Expectation Failed" }, { status: 417 });Flask
return {"error": "Expectation Failed"}, 417Go net/http
http.Error(w, "Expectation Failed", http.StatusExpectationFailed)
nginx
return 417;
Check what a URL returns
Print just the status line from the command line, or check a whole list of URLs at once, with their response headers, in the HTTP Status Checker.
curl -sI https://example.com/your-path | head -n 1
Frequently asked questions
How do I stop curl sending Expect: 100-continue?
Pass an empty header: curl -H 'Expect:' …. curl only adds it for large bodies, so small requests aren't affected.
Related status codes