HTTP status code · Client errors (4xx)
417 Expectation Failed
417 Expectation Failed means a server on the path could not meet what the Expect request header asked for. In practice the header is Expect: 100-continue on a large upload, and an old proxy in between does not support it.
| Class | 4xx, Client errors |
|---|---|
| Defined in | RFC 9110 §15.5.18 |
| Cacheable by default | Only with explicit Cache-Control or Expires |
| Safe to retry | Yes, RFC 9110 says to repeat the request without the Expect header |
| Relevant headers |
|
What 417 means
RFC 9110, section 15.5.18, defines 417 as the expectation in the Expect header not being met by at least one inbound server. Section 10.1.1 defines 100-continue as the only expectation; a server that receives any other value may reject it with 417. A client that gets 417 after sending 100-continue should resend without it, since the 417 only means the chain, perhaps through an HTTP/1.0 hop, does not do expectations.
Node.js and Go both answer 417 on their own for an Expect value other than 100-continue. Node lets you intercept this with the checkExpectation event on the server.
Common causes
If you run the server
- An HTTP client adds Expect: 100-continue to large uploads (curl does for big POST bodies, .NET HttpWebRequest did by default) and an old proxy rejects it.
- Custom code sets an Expect value other than 100-continue, which Node.js and Go servers refuse automatically.
How to fix it
If you run the server
- Resend without the header. With curl, pass -H "Expect:" to suppress it; in .NET, set ServicePointManager.Expect100Continue = false or HttpClient DefaultRequestHeaders.ExpectContinue = false.
- Upgrade or reconfigure the proxy so it forwards Expect: 100-continue or answers it with 100 Continue itself.
How to diagnose 417
Node.js and Go generate 417 automatically for unknown expectations, so there is rarely a reason to send it from a handler. In Node, listen for checkExpectation on the http.Server if you want to accept a custom value instead.
# Suppress curl's automatic Expect: 100-continue
curl -H 'Expect:' -T big-file.bin https://upload.example.com/files/Commonly confused with
- 417 vs 100
- 100 Continue is the positive answer to Expect: 100-continue; 417 is the negative one.
- 417 vs 412
- 412 fails an If-* condition about the resource; 417 fails the Expect header about the connection chain.
Frequently asked questions
- What does Expect: 100-continue do?
- It asks the server to confirm with 100 Continue before the client sends a large body, so the server can reject the request (401, 413) without the upload being wasted.
- How do I stop curl from sending Expect: 100-continue?
- Add -H "Expect:" to the command. An empty header value tells curl to drop that header from the request.
- Is it safe to retry after 417?
- Yes. RFC 9110 says a client that receives 417 in response to a 100-continue expectation should repeat the request without it.
Last reviewed by Arielton Oberek.