Error Codes Wiki

HTTP 417 Expectation Failed — Expect Header Rejected

Informational4xx client error

About HTTP 417 Expectation Failed

HTTP 417 Expectation Failed means the server cannot meet the requirements indicated by the Expect request header, commonly Expect: 100-continue. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: Most commonly triggered by the Expect: 100-continue header. Client sends Expect: 100-continue to check if server will accept the body before sending it. If the server returns 417, the client should resend without the Expect header. Some older HTTP/1.0 proxies do not understand the Expect header. curl automatically sends Expect: 100-continue for POST bodies larger than 1024 bytes. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: Server or proxy does not support Expect: 100-continue mechanism. HTTP/1.0 proxy in the chain stripping or rejecting Expect header. Misconfigured reverse proxy not forwarding Expect headers properly. Server explicitly rejecting the expectation before body is sent. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Remove the Expect header from your request and retry. In curl, disable it with: curl -H 'Expect:' (empty value) your-url. In PHP curl: curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));. Check if an intermediary proxy is causing the issue by testing directly against origin. Update HTTP client library as newer versions handle Expect negotiation better. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

What is the Expect: 100-continue mechanism?

The client asks the server if it will accept the request body before actually sending it, saving bandwidth if the server would reject it.

Overview

HTTP 417 Expectation Failed means the server cannot meet the requirements indicated by the Expect request header, commonly Expect: 100-continue.

Key Details

  • Most commonly triggered by the Expect: 100-continue header
  • Client sends Expect: 100-continue to check if server will accept the body before sending it
  • If the server returns 417, the client should resend without the Expect header
  • Some older HTTP/1.0 proxies do not understand the Expect header
  • curl automatically sends Expect: 100-continue for POST bodies larger than 1024 bytes

Common Causes

  • Server or proxy does not support Expect: 100-continue mechanism
  • HTTP/1.0 proxy in the chain stripping or rejecting Expect header
  • Misconfigured reverse proxy not forwarding Expect headers properly
  • Server explicitly rejecting the expectation before body is sent

Steps

  1. 1Remove the Expect header from your request and retry
  2. 2In curl, disable it with: curl -H 'Expect:' (empty value) your-url
  3. 3In PHP curl: curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
  4. 4Check if an intermediary proxy is causing the issue by testing directly against origin
  5. 5Update HTTP client library as newer versions handle Expect negotiation better

Tags

http417expectation-failedexpect-header100-continue

More in 4xx Client Error

Frequently Asked Questions

The client asks the server if it will accept the request body before actually sending it, saving bandwidth if the server would reject it.