Disable cache for directory listings

This commit is contained in:
Your Name 2018-09-02 19:25:55 +00:00
parent d6035aa01b
commit e1abbb6f33
1 changed files with 4 additions and 0 deletions

View File

@ -51,6 +51,10 @@ func mapDirOpenError(originalErr error, name string) error {
func dirList(w http.ResponseWriter, r *http.Request, f http.File) { func dirList(w http.ResponseWriter, r *http.Request, f http.File) {
tableheader := "" tableheader := ""
// Disable cache for directory indexes
w.Header().Set("Cache-Control", "no-cache")
dirs, err := f.Readdir(-1) dirs, err := f.Readdir(-1)
if err != nil { if err != nil {
logf(r, "http: error reading directory: %v", err) logf(r, "http: error reading directory: %v", err)