From 3a5804d235eff54d4c9be469489038fa862c14b4 Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Tue, 31 Jan 2023 15:59:13 +0300 Subject: [PATCH] perf(web): temporary set thumbs directory equal to files dir --- web/server/web-server.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/server/web-server.go b/web/server/web-server.go index 6354079..cd9a5a8 100644 --- a/web/server/web-server.go +++ b/web/server/web-server.go @@ -213,9 +213,12 @@ func main() { }) http.HandleFunc("/AUTH", HandlerAuth) http.HandleFunc("/TDBMS", Auth(HandlerTDBMS)) - tfm_fs := http.StripPrefix("/files", http.FileServer(http.Dir("/srv/data/tfm"))) + tfm_fs := http.FileServer(http.Dir("/srv/data/tfm")) http.Handle("/files/", Auth(func(w http.ResponseWriter, r *http.Request) { - tfm_fs.ServeHTTP(w, r) + http.StripPrefix("/files", tfm_fs).ServeHTTP(w, r) + })) + http.Handle("/thumbs/", Auth(func(w http.ResponseWriter, r *http.Request) { + http.StripPrefix("/thumbs", tfm_fs).ServeHTTP(w, r) })) log.Println("Running...") err = server.ListenAndServeTLS("/etc/ssl/certs/web-global.crt", "/etc/ssl/private/web-global.key")