git » gofer » commit 27b84b3

http: Fix DirOpts matching for virtualized domains

author Alberto Bertogli
2020-06-08 00:27:37 UTC
committer Alberto Bertogli
2020-06-08 00:27:37 UTC
parent eee13833fe2a89180180488bd6df723de54ded61

http: Fix DirOpts matching for virtualized domains

server/http.go +2 -2

diff --git a/server/http.go b/server/http.go
index 373eba3..6286f51 100644
--- a/server/http.go
+++ b/server/http.go
@@ -230,10 +230,10 @@ func pathOrOpaque(u url.URL) string {
 }
 
 func makeDir(from string, to url.URL, conf *config.HTTP) http.Handler {
-	from = stripDomain(from)
 	path := pathOrOpaque(to)
-
 	fs := http.FileServer(NewFS(http.Dir(path), conf.DirOpts[from]))
+
+	from = stripDomain(from)
 	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		tr, _ := trace.FromContext(r.Context())
 		tr.Printf("serving dir root %q", path)