diff options
author | lunnyxiao <xiaolunwen@gmail.com> | 2014-09-22 10:45:20 +0800 |
---|---|---|
committer | lunnyxiao <xiaolunwen@gmail.com> | 2014-09-22 10:45:20 +0800 |
commit | 79ec08141af6f156597064f5fcafc4d0af2e1a05 (patch) | |
tree | a4bc8452565eb2ac1fe2b432b1616c03572db7da /cmd | |
parent | 150eef93b2340f665c070158ade1863339829e05 (diff) | |
parent | 1273b3d3a985e0aeb88c632e27d0e8dbc8dd2e19 (diff) |
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -97,9 +97,10 @@ func newMacaron() *macaron.Macaron { Config: *setting.SessionConfig, })) m.Use(csrf.Generate(csrf.Options{ - Secret: setting.SecretKey, - SetCookie: true, - Header: "X-Csrf-Token", + Secret: setting.SecretKey, + SetCookie: true, + Header: "X-Csrf-Token", + CookiePath: setting.AppSubUrl, })) m.Use(toolbox.Toolboxer(m, toolbox.Options{ HealthCheckFuncs: []*toolbox.HealthCheckFuncDesc{ @@ -363,6 +364,15 @@ func runWeb(*cli.Context) { r.Any("/:reponame/*", ignSignInAndCsrf, repo.Http) }) + // robots.txt + m.Get("/robots.txt", func(ctx *middleware.Context) { + if setting.HasRobotsTxt { + ctx.ServeFile(path.Join(setting.CustomPath, "robots.txt")) + } else { + ctx.Error(404) + } + }) + // Not found handler. m.NotFound(routers.NotFound) |