Skip to content

Commit f96e8be

Browse files
authored
Use custom favicon when viewing static files if it exists (#19130)
Redirect `/favicon.ico` to `/assets/img/favicon.png`. Fix #19109
1 parent 3322f4d commit f96e8be

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

routers/web/web.go

+5
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ func Routes(sessioner func(http.Handler) http.Handler) *web.Route {
9999
http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "/assets/img/apple-touch-icon.png"), 301)
100100
})
101101

102+
// redirect default favicon to the path of the custom favicon with a default as a fallback
103+
routes.Get("/favicon.ico", func(w http.ResponseWriter, req *http.Request) {
104+
http.Redirect(w, req, path.Join(setting.StaticURLPrefix, "/assets/img/favicon.png"), 301)
105+
})
106+
102107
common := []interface{}{}
103108

104109
if setting.EnableGzip {

0 commit comments

Comments
 (0)