417 Expectation Failed
The client sent an Expect header (usually Expect: 100-continue) that the server or an intermediary will not satisfy.
The server cannot meet the requirements of the Expect request header.
What HTTP 417 Expectation Failed Means
The server cannot meet the requirements of the Expect request header.
The client sent an Expect header (usually Expect: 100-continue) that the server or an intermediary will not satisfy.
Common Causes
- Expect: 100-continue rejected by the server or proxy
- Unsupported expectation value
- A proxy that does not handle 100-continue
How to Fix It (For Visitors)
- Retry the request
How to Fix It (For Developers/Admins)
- Remove the Expect header or stop sending 100-continue
- Configure the proxy to support Expect
- Fall back to sending the body immediately
Returning a 417 Expectation Failed (Code Examples)
If you build APIs or web apps, here is how to send an HTTP 417 response and how to test for it:
Node.js (Express)
app.get('/resource', (req, res) => {
res.status(417).json({ error: 'Expectation Failed' });
});
Python (Flask)
@app.route('/resource')
def resource():
return jsonify(error='Expectation Failed'), 417
PHP
<?php
http_response_code(417);
header('Content-Type: application/json');
echo json_encode(['error' => 'Expectation Failed']);
Check the status with curl
curl -I https://example.com/resource
# Look for: HTTP/1.1 417 Expectation Failed
Frequently Asked Questions
What does HTTP 417 Expectation Failed mean?
The client sent an Expect header (usually Expect: 100-continue) that the server or an intermediary will not satisfy. In short: The server cannot meet the requirements of the Expect request header.
Is 417 Expectation Failed a client or server error?
417 is a 4xx client-error code, so the request itself needs to change. The server is running normally and is rejecting the request as it was sent by the browser, app, or API client.
How do I fix a 417 Expectation Failed error?
Remove the Expect header or stop sending 100-continue. Configure the proxy to support Expect. Fall back to sending the body immediately.
Official Specification
The 417 Expectation Failed status code is defined in RFC 9110 Section 15.5.18.