Skip to content

Commit f61211a

Browse files
committed
Redirect /serviceworker.js to assets/
Signed-off-by: Andrew Thornton <[email protected]>
1 parent d37a89e commit f61211a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

routers/routes/web.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ func WebRoutes() *web.Route {
162162
// We use r.Route here over r.Use because this prevents requests that are not for avatars having to go through this additional handler
163163
routes.Route("/avatars/*", "GET, HEAD", storageHandler(setting.Avatar.Storage, "avatars", storage.Avatars))
164164
routes.Route("/repo-avatars/*", "GET, HEAD", storageHandler(setting.RepoAvatar.Storage, "repo-avatars", storage.RepoAvatars))
165+
routes.Route("/serviceworker.js", "GET, HEAD", http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
166+
http.Redirect(resp, req, setting.AppURL+"assets/serviceworker.js", http.StatusFound)
167+
}))
165168

166169
// for health check - doeesn't need to be passed through gzip handler
167170
routes.Head("/", func(w http.ResponseWriter, req *http.Request) {

0 commit comments

Comments
 (0)