417 Expectation Failed: what it means and how to fix it
A 417 means the server can't meet the condition in the request's Expect header, almost always Expect: 100-continue. Why proxies and old servers send it, and the fix.
· 5 min read · By the Spot Downtime team
A 417 Expectation Failed means the server looked at the Expect header on your request and could not do what it asks. The only expectation defined in the HTTP standard is 100-continue, so in practice a 417 almost always means one thing: a client asked “may I send the body?” and something along the path did not know how to answer.
It is rare on ordinary websites and common in API clients, uploads and anything that goes through an older proxy. This post explains the mechanism, the usual culprits and the fixes.
How Expect: 100-continue works
Sending a large body only to have the server reject it (wrong credentials, too big, wrong path) wastes bandwidth. Expect: 100-continue avoids that. The client sends the headers first, with the header Expect: 100-continue, and waits. The server replies with an interim 100 Continue if it is happy to receive the body, or a final error status if it is not. Only after the 100 does the client send the body.
POST /upload HTTP/1.1
Host: api.example.com
Content-Length: 52428800
Expect: 100-continue
HTTP/1.1 100 Continue
(client now sends the 50 MB body)A 417 is the server saying it does not support the expectation. A server that does not understand an Expect value must answer 417 rather than ignore it.
Common causes
- An HTTP/1.0 proxy or an old server in the path. Squid in particular has a history of returning 417 for any request with an
Expectheader, because it did not implement 100-continue when relaying to HTTP/1.0 peers. Some older load balancers and WAFs behave the same way. - A client library that adds the header automatically. curl sends
Expect: 100-continuefor POST and PUT bodies larger than 1 MB (older versions: 1024 bytes). .NET'sHttpWebRequestandServicePointManagerenable it by default in many versions. Your code never mentions the header, but it goes on the wire. - A custom or unusual Expect value. Anything other than
100-continueis unknown to most servers and earns a 417 by design. - A gateway that rejects the header outright. Some API gateways and reverse proxies are configured to refuse requests with
Expectrather than handle the interim response.
Reproduce it with curl
Add the header yourself and look at what comes back. Use a small body so the test is quick.
curl -i -X POST https://api.example.com/upload \
-H "Expect: 100-continue" \
--data-binary @small.jsonThen send the same request with the header removed. In curl, an empty value for a header removes it:
curl -i -X POST https://api.example.com/upload \
-H "Expect:" \
--data-binary @small.jsonIf the first returns 417 and the second succeeds, you have confirmed that the path cannot handle 100-continue. If both fail, the 417 is not your only problem and you should look at the other status code the second call returns.
Fix it in the client
The simplest and most reliable fix is to stop sending the header. You lose a small optimisation and gain compatibility.
- curl: add
-H "Expect:". In libcurl, set theCURLOPT_HTTPHEADERlist to includeExpect:. - .NET Framework: set
System.Net.ServicePointManager.Expect100Continue = false;before creating requests. WithHttpClienton modern .NET, setclient.DefaultRequestHeaders.ExpectContinue = false;. - Other libraries: look for a setting named
expect-continue,Expect100Continueor similar and turn it off, or strip the header in a request hook.
// .NET Framework
System.Net.ServicePointManager.Expect100Continue = false;
// Modern .NET
var client = new HttpClient();
client.DefaultRequestHeaders.ExpectContinue = false;Fix it on the server or proxy
If you control the intermediate server and want 100-continue to work instead of being disabled, check these:
- Update the proxy. Current nginx, HAProxy, Squid and cloud load balancers handle 100-continue. Very old versions, or proxies configured to refuse the header, are the usual source of 417.
- Check the whole chain. A CDN, a WAF and an internal gateway may each treat the header differently. Test directly against the origin to find which hop answers 417.
Who answered?
Server, Via or X-Cache header naming a proxy product points at the hop that rejected the header. Compare with a direct request to the origin.Is 417 an outage?
Usually not. A 417 tells you the server is alive and parsing requests; it is rejecting one specific request pattern. Monitoring tools do not normally send Expect, so a 417 on a monitor is unusual and worth reading as a hint that something in front of your origin has changed, such as a new proxy or WAF rule.
The case worth watching is an API that real clients call with uploads. If a gateway change starts rejecting Expect, uploads fail while your homepage stays green. An API monitor that sends a real POST with the headers your clients use, and checks the status code and response body, catches that.
HTTP header checkerSee exactly what a URL returns, headers included.Quick checklist
-H "Expect:". If it works, disable the header in the client. If you need 100-continue, find the old proxy or gateway in the path and update or reconfigure it.Related reading
Get new guides by email
Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.
Keep reading
- HTTP errors · HTTP · Troubleshooting304 Not Modified: what it means and how conditional requests workA 304 is not an error: it means the cached copy is still good. How ETag and Last-Modified revalidation works, why a 304 can go wrong, and how to debug stale content.November 26, 2026 · 7 min read
- HTTP errors · TroubleshootingRandom 502 errors behind a load balancer: the keep-alive timeout mismatchRare, unpredictable 502s with a healthy backend often come from keep-alive timeouts: the app closes idle connections before the proxy does. How to confirm and fix it.November 26, 2026 · 6 min read