204No Content
The request worked and there is deliberately nothing in the response body.
How you get a 204
A DELETE asks the app to remove a record. The database removes it and the app sends 204. The response is headers only, because there is nothing left to show.
Who sends itApp · Proxy
- Browser
- CDN
- Proxy
- App
- DB
Typically the application, after a delete or a save. A proxy or gateway often sends it too, as the answer to a CORS preflight request that never reaches the app.
In short
What a 204 No Content means
A 204 No Content says the request succeeded and the server has nothing to send back. It is the usual answer to a DELETE, to a save that the client does not need echoed, and to the preflight OPTIONS request a browser makes before a cross-origin call. The response ends after its headers; a 204 cannot carry a body. The application normally sends it, but preflight requests are often answered by a proxy or gateway without involving the app at all. The classic bug sits on the client side: code that always parses the response as JSON throws on a 204, because an empty body is not valid JSON, and a successful delete shows up as an error in the interface.
When you see a 204
1A DELETE succeeded and there is nothing to return.
How to check: A following GET for the same URL should answer 404.
curl -si -X DELETE https://example.com/api/items/42 | head -12A PUT or PATCH saved the change and the API chose not to echo it back.
How to check: Look for an ETag header carrying the new version.
3A CORS preflight was approved.
How to check: The request method is OPTIONS and the response has Access-Control-Allow headers.
curl -si -X OPTIONS https://api.example.com/items -H 'Origin: https://app.example.com' -H 'Access-Control-Request-Method: POST'4A tracking or beacon endpoint acknowledged a hit.
How to check: Nothing to check: these endpoints answer 204 on purpose so the browser does nothing.
Retry or not?
Nothing to retry
Headers that matter
- ETag
- After a save, the version of the resource as it is now.
- Access-Control-Allow-*
- On a preflight answer, these say which origins, methods and headers the real request may use.
- Content-Length
- Absent or zero. A 204 with a body is a server bug, and some proxies will cut it off.
In the real world
RFC vs real deployments
RFC 9110 says a 204 response ends after the header section and cannot contain content. Clients are less tidy. The common failure is code that calls a JSON parser on every response, which throws on an empty body, so a successful delete is reported to the user as an error. Check the status before parsing.
Seen in a real outage
A delete that “worked” says nothing about whether it deleted the right thing. In 2022 an Atlassian cleanup script was handed the wrong IDs and removed 883 whole customer sites, successfully.
Your turn
Which code is it?
After a successful DELETE, the interface shows “Something went wrong” and the console says “Unexpected end of JSON input”. The network tab shows status 204. What is wrong?
204 questions
- Is 204 No Content an error?
- No. It is a success code. It tells the client the action worked and there is no body to read.
- Who sends a 204?
- Typically the application after a delete or save. A proxy or API gateway also sends it when it answers a CORS preflight request by itself.
- Should a DELETE return 200 or 204?
- Either is valid. Use 204 when there is nothing to send back, and 200 when the response includes a body, such as the deleted item or a status message.
Sources: RFC 9110: 204 No Content (section 15.3.5) ↗ · Fetch Standard: CORS preflight ↗ · Report a problem
Diagrams are our own simulations. All wording is original and paraphrases the linked sources.
Practise this in the DNS / HTTP track
Two-minute animated lessons, then boss fights from real outages. Free, no account needed.