Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

For static html pages, when the response header from the server is 304 Not Modified, isn't it the server's responsibility to send back only the headers and not the message-body (html content) along with it ?

Whats the point in sending 304 Not Modified if it comes along with the html content too ?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

There is no point to sending a message body with a 304 response. In fact, the HTTP specification says that the server must not do so. If you have one that is, it's misbehaving according to the spec.

From the HTTP Specification:

The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields.

share|improve this answer
    
My HTML file resides on a nginx server and on hitting F5, monitoring net activity using FireBug, the bytes returned is the same with response containing message body as well. –  anjanesh Aug 9 '10 at 2:24
    
What's probably happening in your situation is your browser is getting the correctly formed 304 response from nginx and then pulling the page from its cache and passing it on to FireBug. Do you have a tool that will show you the entire conversation? Fiddler or WebScarab would show you the conversation. –  squillman Aug 9 '10 at 3:00
    
Thanks. I just verified this using curl. curl --dump-header header.txt --header "If-Modified-Since: Sun, 08 Aug 2010 17:43:07 GMT" myurl.com/page.html cat header.txt HTTP/1.1 304 Not Modified Server: nginx Date: Mon, 09 Aug 2010 23:14:26 GMT Connection: keep-alive ETag: "16f8016-43c-48d536ec440c0" No message body ! –  anjanesh Aug 9 '10 at 23:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.