@@ -418,9 +418,10 @@ func (e *Echo) serveFile(dir, file string, c *Context) (err error) {
418
418
419
419
fi , _ := f .Stat ()
420
420
if fi .IsDir () {
421
- if checkLastModified (c .response , c .request , fi .ModTime ()) {
422
- return
423
- }
421
+ /* NOTE:
422
+ Not checking the Last-Modified header as it caches the response `304` when
423
+ changing differnt directories for the same path.
424
+ */
424
425
d := f
425
426
426
427
// Index file
@@ -693,25 +694,3 @@ func (binder) Bind(r *http.Request, i interface{}) (err error) {
693
694
}
694
695
return
695
696
}
696
-
697
- // Source: net/http/fs.go
698
- func checkLastModified (w http.ResponseWriter , r * http.Request , modtime time.Time ) bool {
699
- if modtime .IsZero () || modtime .Equal (unixEpochTime ) {
700
- // If the file doesn't have a modtime (IsZero), or the modtime
701
- // is obviously garbage (Unix time == 0), then ignore modtimes
702
- // and don't process the If-Modified-Since header.
703
- return false
704
- }
705
-
706
- // The Date-Modified header truncates sub-second precision, so
707
- // use mtime < t+1s instead of mtime <= t to check for unmodified.
708
- if t , err := time .Parse (http .TimeFormat , r .Header .Get ("If-Modified-Since" )); err == nil && modtime .Before (t .Add (1 * time .Second )) {
709
- h := w .Header ()
710
- delete (h , "Content-Type" )
711
- delete (h , "Content-Length" )
712
- w .WriteHeader (http .StatusNotModified )
713
- return true
714
- }
715
- w .Header ().Set ("Last-Modified" , modtime .UTC ().Format (http .TimeFormat ))
716
- return false
717
- }
0 commit comments