내가 http.FileServer
가 설정 한 Last-Modified
-header를 대체하기 위해 노력하고있어,하지만 내가 제공하기 위해 노력하고있어 파일의 Last-Modified
- 시간에 돌아갑니다 :재정 마지막으로 수정 헤더 http.FileServer
var myTime time.Time
func main() {
myTime = time.Now()
fs := http.StripPrefix("/folder/", SetCacheHeader(http.FileServer(http.Dir("/folder/"))))
http.Handle("/folder/", fs)
http.ListenAndServe(":80", nil)
}
내 SetCacheHeader
-handler는 :
func SetCacheHeader(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Last-Modified", myTime.Format(http.TimeFormat))
h.ServeHTTP(w, r)
})
}