epicagency / caddy-expires

Provides a directive to add expires headers to certain paths
MIT License
4 stars 3 forks source link

Expires header not sufficient to bypass browser caching #1

Closed ebudan closed 5 years ago

ebudan commented 7 years ago

This is noticed on Chrome (Version 54.0.2840.71 (64-bit)) and Firefox (49.0.2) on OS X:
The Expires header itself is not enough to persuade the browser to reload a modified page. In Safari, seems to work as expected.

(Edit: removed comment regarding Last-Modified - was not correct. Added browser info.)

ebudan commented 7 years ago

Adding the following in ServeHTTP() would seem to resolve caching in the mentioned browsers:

...
w.Header().Set("Cache-Control", "public, max-age="+strconv.Itoa(int(rule.Duration.Seconds()))) 
...
hlidotbe commented 7 years ago

ok. That I can do.

Setting Last-Modified should be done by Caddy itself as it would make much more sense.

hlidotbe commented 5 years ago

Done (finally)