Skip to content

Support conditional GET for static files #83

@joh

Description

@joh

It seems Flask doesn't support the conditional GET for static files. It always returns 200 OK, even though the file is older than the If-Modified-Since request header.

Consider the following example:

/static$ ls -l browser.css
-rw-r--r-- 1 joh joh 600 2010-07-13 22:25 browser.css

Now perform a conditional GET with curl:

$ curl -I -z "Tue, 13 Jul 2010 20:37:52 GMT" http://localhost:8080/static/browser.css
HTTP/1.0 200 OK
Content-Type: text/css; charset=utf-8
Cache-Control: public, max-age=43200
Expires: Wed, 14 Jul 2010 08:42:44 GMT
ETag: "flask-1279052703.2-600-2392659594"
Date: Tue, 13 Jul 2010 20:42:44 GMT
Connection: close
Server: Werkzeug/0.6.2 Python/2.6.5

Just as a comparison, here's the correct response from Apache:

$ curl -I -z "Tue, 13 Jul 2010 20:37:52 GMT" http://localhost/jq.html
HTTP/1.1 304 Not Modified
Date: Tue, 13 Jul 2010 20:43:47 GMT
Server: Apache/2.2.14 (Ubuntu)
ETag: "1540072-3f-48b36b51d6983"
Vary: Accept-Encoding

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions