417 Expectation Failed

The HTTP 417 Expectation Failed status code is a client error returned by the server to indicate the conditions set by the client using the Expect header are not satisfiable.

Usage

When the 417 Expectation Failed error message is received, the client specified one or more conditions for proactive negotiation in the Expect header of the request. This is related to the informational 100 response.

When a request is submitted using the Expect: 100-continue header, the server examines relevant details of the request. These include the Content-Type or Content-Length header fields. If the server is willing to accept the message body, the 100 informational response is returned.

If the server is unwilling to accept the message body, an appropriate status is sent, such as 401 or 405. The 417 Expectation Failed error is only returned when the server or response chain does not support expectations. If this message is received, the client resends the request without the Expect header.

SEO impact

Search engines like Google will not index a URL with a 417 Expectation Failed response status. URLs previously indexed will be removed from search results.

Special consideration for clients

A client sending Expect: 100-continue is not required to wait for a specific length of time. The client proceeds to transmit the message body without first receiving a response. As HTTP/1.0 servers do not support expectations, when one is used as an intermediary, the client does not wait an indefinite period before transmitting the message body.

Special consideration for servers

If a server receives Expect: 100-continue as part of an HTTP/1.0 request, the expectation must be ignored. The server does not need to acknowledge with 100 if the message body has already been received or if no message body exists.

When a server sends 100, a final status such as 200 must ultimately follow unless the connection is dropped beforehand.

If a server responds with the final response before receiving the entire message body, the response indicates what the server intends to do with the connection: close the connection or continue reading and discard the request message.

Example

The client requests to send a 10K PDF file. The server responds with 417 Expectation Failed because expectations are not supported.

Request

PUT /docs HTTP/1.1
Host: www.example.re
Content-Type: application/pdf
Content-Length: 10000
Expect: 100-continue

Response

HTTP/1.1 417 Expectation Failed
Content-Type: text/html
Content-Length: 159

<html>
  <head>
    <title>Expectations not supported</title>
  </head>
  <body>
   <p>Expectations are not supported by this server.
   </p>
  </body>
</html>

How to fix

Remove the Expect: 100-continue header and resend the request with the full body included. The server or an intermediary proxy does not support the 100-continue mechanism.

Many HTTP client libraries add the Expect: 100-continue header automatically for large payloads without explicit instruction. Disable this behavior at the library level:

  • .NET: Set ServicePointManager.Expect100Continue = false globally, or per-request with HttpClient.DefaultRequestHeaders.ExpectContinue = false. The same setting is available in app.config under system.net > settings > servicePointManager.
  • curl: Pass -H "Expect:" (empty value) to suppress the header. curl adds Expect: 100-continue automatically for POST bodies larger than 1024 bytes.
  • Python requests: The library does not send the Expect header by default, but custom transport adapters or proxies between the client and server sometimes inject the header.

Proxy and intermediary issues. HTTP/1.0 proxies, load balancers, and older gateways do not understand the Expect: 100-continue handshake. When the request passes through such an intermediary, the proxy rejects the request before the origin server processes the expectation. Upgrading the proxy or routing around HTTP/1.0 intermediaries resolves the issue in these environments.

On the server side, this status is rare in modern HTTP stacks. Most servers either honor Expect: 100-continue or silently ignore the header. Returning 417 is a deliberate signal to remove the expectation from the request.

Code references

.NET

HttpStatusCode.ExpectationFailed

Rust

http::StatusCode::EXPECTATION_FAILED

Rails

:expectation_failed

Go

http.StatusExpectationFailed

Symfony

Response::HTTP_EXPECTATION_FAILED

Python3.5+

http.HTTPStatus.EXPECTATION_FAILED

Java

HttpServletResponse.SC_EXPECTATION_FAILED

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_EXPECTATION_FAILED

Angular

@angular/common/http/HttpStatusCode.ExpectationFailed

Takeaway

The 417 Expectation Failed status code is a client error sent because the server does not support expectations, yet one was included with the request.

See also

Last updated: March 9, 2026