Question

I'm trying to force force a response with the 304 not modified status code using telnet. I don't see a problem with my commands but I'm still having a 200 OK status.

telnet lemonde.fr 80

GET /index.html HTTP/1.1
User-Agent: Mozilla/5.0
From: yahoo.com 
Accept: text/html,text/plain,application/*
Host: www.lemonde.fr
If-Modified-Since: Wed, 19 Oct 2015 10:50:00 GMT
<linefeed>

HTTP/1.1 200 OK
Server: Apache
Last-Modified: Wed, 30 Oct 2013 00:32:31 GMT
Vary: Accept-Encoding
X-Server: noisy
Cache-Control: max-age=60
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 30 Oct 2013 00:36:11 GMT
X-Varnish: 391424540 391424396
Age: 13
Via: 1.1 varnish
X-Varnish-Cache: HIT
X-Varnish-Server: noisy.lemonde.fr

No correct solution

OTHER TIPS

Calculating the date difference is rather convoluted, considering that the HTTP specification allows three wildly different date formats.

What is the simplest way for a browser to construct an IMS (If-Modified-Since) header? Why, you send back the exact same string that you received from the server!

With this in mind, what is the simplest way for the server to determine how to respond to the IMS request? Do a simple string comparison between the IMS and the Last-Modified header! If they match, send a 304. If not, send the full 200.

If you make up your own date string, you're likely to get a 200 response, regardless of what the actual dates are.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top