Django ETag doesn’t work on my local machine. Why?

Django Etag doesn’t work on my local machine via the virtual webserver.

The reason is that browser sends a request via HTTP/1.1 and django sends a response via HTTP/1.0.

How I can update the version on my machine? Here’s a monkey patch that tweak the version number.

Do not use it on your web server if you use a web webserver such as apache or nginx.

 

# HACK: without HTTP/1.1, Chrome ignores certain cache headers during development!
#       see http://stackoverflow.com/a/28033770/179583 for a bit more discussion.
from wsgiref import simple_server
simple_server.ServerHandler.http_version = "1.1"

I found this monkey patch from stackoverflow.com but unfortunately I lost the link. 😦

Advertisements