aboutsummaryrefslogtreecommitdiff
path: root/cmd/web.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/web.go')
-rw-r--r--cmd/web.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/cmd/web.go b/cmd/web.go
index 45f35a35..a5ebf259 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -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)