@@ -108,7 +108,7 @@ func Routes() *web.Route {
108108 routes := web .NewRoute ()
109109
110110 routes .Head ("/" , misc .DummyOK ) // for health check - doesn't need to be passed through gzip handler
111- routes .RouteMethods ("/assets/*" , "GET, HEAD" , CorsHandler (), public .AssetsHandlerFunc ( "/assets/" ))
111+ routes .RouteMethods ("/assets/*" , "GET, HEAD" , CorsHandler (), public .FileHandlerFunc ( ))
112112 routes .RouteMethods ("/avatars/*" , "GET, HEAD" , storageHandler (setting .Avatar .Storage , "avatars" , storage .Avatars ))
113113 routes .RouteMethods ("/repo-avatars/*" , "GET, HEAD" , storageHandler (setting .RepoAvatar .Storage , "repo-avatars" , storage .RepoAvatars ))
114114 routes .RouteMethods ("/apple-touch-icon.png" , "GET, HEAD" , misc .StaticRedirect ("/assets/img/apple-touch-icon.png" ))
@@ -132,15 +132,12 @@ func Routes() *web.Route {
132132 routes .RouteMethods ("/captcha/*" , "GET,HEAD" , append (mid , captcha .Captchaer (context .GetImageCaptcha ()))... )
133133 }
134134
135- if setting .HasRobotsTxt {
136- routes .Get ("/robots.txt" , append (mid , misc .RobotsTxt )... )
137- }
138-
139135 if setting .Metrics .Enabled {
140136 prometheus .MustRegister (metrics .NewCollector ())
141137 routes .Get ("/metrics" , append (mid , Metrics )... )
142138 }
143139
140+ routes .Get ("/robots.txt" , append (mid , misc .RobotsTxt )... )
144141 routes .Get ("/ssh_info" , misc .SSHInfo )
145142 routes .Get ("/api/healthz" , healthcheck .Check )
146143
@@ -336,8 +333,7 @@ func registerRoutes(m *web.Route) {
336333
337334 // FIXME: not all routes need go through same middleware.
338335 // Especially some AJAX requests, we can reduce middleware number to improve performance.
339- // Routers.
340- // for health check
336+
341337 m .Get ("/" , Home )
342338 m .Get ("/sitemap.xml" , sitemapEnabled , ignExploreSignIn , HomeSitemap )
343339 m .Group ("/.well-known" , func () {
@@ -349,7 +345,8 @@ func registerRoutes(m *web.Route) {
349345 m .Get ("/change-password" , func (ctx * context.Context ) {
350346 ctx .Redirect (setting .AppSubURL + "/user/settings/account" )
351347 })
352- })
348+ m .Any ("/*" , CorsHandler (), public .FileHandlerFunc ())
349+ }, CorsHandler ())
353350
354351 m .Group ("/explore" , func () {
355352 m .Get ("" , func (ctx * context.Context ) {
0 commit comments