aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-13 12:32:41 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-13 12:32:41 -0400
commitb21946cf0c10f726ae6cf129678e0ee2eba07dc8 (patch)
tree60f38cc4087fbda0506665b3f3f19217614fa799
parente7ce628138d5799eb3e8866ab269013c1c58ff77 (diff)
downloadAtlas-b21946cf0c10f726ae6cf129678e0ee2eba07dc8.tar.gz
Atlas-b21946cf0c10f726ae6cf129678e0ee2eba07dc8.zip
web: Rewrite /favicon.ico -> /assets/favicon.ico
-rw-r--r--web/web.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/web/web.go b/web/web.go
index f76db8e..0f82148 100644
--- a/web/web.go
+++ b/web/web.go
@@ -4,6 +4,7 @@ package web
import (
"embed"
"net/http"
+ "net/url"
"strings"
"time"
)
@@ -37,6 +38,17 @@ func ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
+ // rewrite /favicon.ico -> /assets/favicon.ico
+ if r.URL.Path == "/favicon.ico" {
+ r2 := new(http.Request)
+ *r2 = *r
+ r2.URL = new(url.URL)
+ *r2.URL = *r.URL
+ r2.URL.Path = "/assets/favicon.ico"
+ r2.URL.RawPath = r2.URL.Path
+ r = r2
+ }
+
// this handles range requests, etags, time, etc
http.FileServer(http.FS(Assets)).ServeHTTP(w, r)
}