204: No content and Google Bot

What if this page returned 204: No content, but still would have content in the http body? Not just content, but meaningful, worthy of indexing content just like these wonderful words?

Unfortunately, modern browsers don’t open the 204s. Therefore. if I set the 204 for this page, you wouldn’t be able to read this text, so the actual 204 would be here.

Feel free to try and open/inspect it if you like. It would seem like a completely empty page. You can add ?1=200 to the end of the url to see the content of the page with the 200 code. That’s how my script works there – it takes three last characters of the url and if they are numeric, uses them in the http header.

Would Google ignore the facts and stop parsing after recognizing the 204? Or would it ignore the response code and index/rank this page as if it was a 200-page? Let’s see.

Probably Google will ignore the page since no browser is able to open it 🙂

What is a 204

I just have to write something more to make sure G doesn’t treat this page as empty, so let’s take a look at what 204 is and what kinds of additional fields it supports.

Wikipedia claims that 204 means “The server successfully processed the request and is not returning any content“.

I, however, prefer this amazing description here:

Metadata in the response header fields refer to the target resource and its selected representation after the requested action was applied.

For example, if a 204 status code is received in response to a PUT request and the response contains an ETag header field, then the PUT was successful and the ETag field-value contains the entity-tag for the new representation of that target resource.

The 204 response allows a server to indicate that the action has been successfully applied to the target resource, while implying that the user agent does not need to traverse away from its current “document view” (if any). The server assumes that the user agent will provide some indication of the success to its user, in accord with its own interface, and apply any new or updated metadata in the response to its active representation.

For example, a 204 status code is commonly used with document editing interfaces corresponding to a “save” action, such that the document being saved remains available to the user for editing. It is also frequently used with interfaces that expect automated data transfers to be prevalent, such as within distributed version control systems.

A 204 response is terminated by the first empty line after the header fields because it cannot contain a message body.

A 204 response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls1.

I found it on https://httpstatuses.com/204 Great stuff.

Leave a Reply

avatar
  Subscribe  
Notify of