diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-13 12:32:41 -0400 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2022-10-13 12:32:41 -0400 |
commit | b21946cf0c10f726ae6cf129678e0ee2eba07dc8 (patch) | |
tree | 60f38cc4087fbda0506665b3f3f19217614fa799 | |
parent | e7ce628138d5799eb3e8866ab269013c1c58ff77 (diff) | |
download | Atlas-b21946cf0c10f726ae6cf129678e0ee2eba07dc8.tar.gz Atlas-b21946cf0c10f726ae6cf129678e0ee2eba07dc8.zip |
web: Rewrite /favicon.ico -> /assets/favicon.ico
-rw-r--r-- | web/web.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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) } |