summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/fileserver/browse.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-11-15 17:32:13 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2019-11-15 17:32:13 -0700
commitb43e986a526c9de83c04c29bc530f1d711a40997 (patch)
tree26c4e943c1423a0f98b4de9fad655602e7c567b7 /modules/caddyhttp/fileserver/browse.go
parent1228dd7d93b59409fd844400b9c114be267df3a3 (diff)
file_server: Optional pass_thru mode
If enabled, will call the next handler in the chain instead of returning a 404.
Diffstat (limited to 'modules/caddyhttp/fileserver/browse.go')
-rw-r--r--modules/caddyhttp/fileserver/browse.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/caddyhttp/fileserver/browse.go b/modules/caddyhttp/fileserver/browse.go
index 91ebcd5..48f2cc7 100644
--- a/modules/caddyhttp/fileserver/browse.go
+++ b/modules/caddyhttp/fileserver/browse.go
@@ -34,7 +34,7 @@ type Browse struct {
template *template.Template
}
-func (fsrv *FileServer) serveBrowse(dirPath string, w http.ResponseWriter, r *http.Request) error {
+func (fsrv *FileServer) serveBrowse(dirPath string, w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
// navigation on the client-side gets messed up if the
// URL doesn't end in a trailing slash because hrefs like
// "/b/c" on a path like "/a" end up going to "/b/c" instead
@@ -59,7 +59,7 @@ func (fsrv *FileServer) serveBrowse(dirPath string, w http.ResponseWriter, r *ht
case os.IsPermission(err):
return caddyhttp.Error(http.StatusForbidden, err)
case os.IsNotExist(err):
- return caddyhttp.Error(http.StatusNotFound, err)
+ return fsrv.notFound(w, r, next)
case err != nil:
return caddyhttp.Error(http.StatusInternalServerError, err)
}