aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorlunnyxiao <xiaolunwen@gmail.com>2014-09-22 10:45:20 +0800
committerlunnyxiao <xiaolunwen@gmail.com>2014-09-22 10:45:20 +0800
commit79ec08141af6f156597064f5fcafc4d0af2e1a05 (patch)
treea4bc8452565eb2ac1fe2b432b1616c03572db7da /cmd
parent150eef93b2340f665c070158ade1863339829e05 (diff)
parent1273b3d3a985e0aeb88c632e27d0e8dbc8dd2e19 (diff)
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'cmd')
-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)