204 No Content: success with an empty response
204 No Content means the request succeeded and the server deliberately sends no body, as is common for API updates and CORS preflights.
204 No Content means the request succeeded and there is deliberately nothing to send back. It’s routine for API updates and deletions, analytics beacons and browser preflight checks, and a problem whenever it’s returned for a page that should have content.
Definition
RFC 9110, section 15.3.5 says the server has fulfilled the request and there is no additional content to send. A 204 can’t carry a body: the response ends with the headers, and any metadata in them describes the target resource after the action. For a browser, a 204 means “stay where you are,” so a link or form that returns 204 doesn’t change the page. A 204 is cacheable by default.
Where 204 is correct
- PUT or PATCH updates and DELETE requests in REST APIs.
- CORS preflight responses to
OPTIONSrequests. - Analytics and tracking endpoints that only need to receive data.
- Connectivity checks: Android, for example, requests a
generate_204URL to detect captive portals.
SEO impact
For HTML pages, 204 is a bug. Google’s documentation says Googlebot signals the indexing pipeline that it received no content, and Search Console may report the URL as a soft 404 in the Page indexing report. As far as Google is concerned, the page is empty, so it won’t rank. Ways it happens:
- A controller returns nothing. ASP.NET Core, for instance, turns a
nullresult from an API action into 204. - A route or middleware ends the response before the template renders.
- A CDN or edge rule written for a beacon path also matches real pages.
How to fix and check
Make page routes always render a template with 200 OK, or return 404 when the item doesn’t exist, never an empty success. Scan important URLs with the HTTP status checker, and use the HTTP header checker to see which layer answered. A correct 204, here for a CORS preflight:
OPTIONS /api/v1/cart HTTP/1.1
Host: api.example.com
Origin: https://www.example.com
Access-Control-Request-Method: PATCH
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: https://www.example.com
Access-Control-Allow-Methods: GET, POST, PATCH
Access-Control-Max-Age: 600 Frequently asked questions
Is 204 No Content an error?
No, it’s a success code. It just means there is nothing to return, which is normal for many API updates, deletions and preflight requests.
Why does Search Console show a soft 404 for a page returning 204?
Google treats a 204 as “no content received.” A page with no content can’t be indexed, so Search Console may flag it as a soft 404. Make the page return 200 with its HTML.
Should a DELETE request return 204 or 200?
Either is fine. Use 204 when there is nothing useful to return, and 200 when you send back a confirmation or the deleted item.