Issue #728 resolved

tools.expires doesn't set a past-date header when secs=0

Anonymous created an issue

Because we are using @cherrypy.tools.expires(secs=0) as the way of saying "this page should never be cached", the "Expires" header should be sent with a past date.

At the end of lib/expires.py def tools(), we can fix this by adding:

{{{ if secs == 0: headers["Expires"] = http.HTTPDate(response.time - 31556926) }}}

This sets the "Expires" header back in time a year when secs=0, which is just arbitrarily chosen, but there are no guidelines for how far back to set the date. Another approach would be to just always set the header to sometime in the 90s.

Reported by hax

Comments (2)

  1. Log in to comment