417 🌐 HTTP

HTTP 417 Expectation Failed

The server or a proxy can’t meet the Expect header in the request — almost always Expect: 100-continue.

Seen on: REST API

Meaning

Some proxies, older IIS/Lighttpd and certain WAFs reject requests carrying Expect: 100-continue with 417. Clients like .NET HttpClient, PHP cURL and curl add that header automatically for larger POST bodies, so uploads fail while small requests work.

Common causes

  • Client auto-adds Expect: 100-continue for large bodies
  • Proxy/WAF/server doesn’t support Expect
  • Custom Expect value the server doesn’t understand

⚡ Quick fix

  1. Send the request without the Expect header
  2. Fix or upgrade the proxy that rejects it

Detailed fix by platform

PHP

  1. curl_setopt($ch, CURLOPT_HTTPHEADER, ['Expect:']);

.NET

  1. csharp
    ServicePointManager.Expect100Continue = false;   // .NET Framework
    client.DefaultRequestHeaders.ExpectContinue = false; // HttpClient

curl

  1. curl -H 'Expect:' -F 'file=@big.zip' https://example.com/upload

How to diagnose

  1. Headers — Expect present in the failing request?
  2. Size — Do small bodies succeed?
  3. Hop — Which proxy returns the 417?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.