adds handling robot.txt rout #154

This commit is contained in:
Sergii Bomko 2018-04-19 09:36:39 +02:00
parent 8ee6561910
commit d98a110aef

View file

@ -850,6 +850,12 @@ func (s *Server) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
return
}
if r.URL.Path == "/robot.txt" {
w.Header().Set("Last-Modified", time.Now().Format(http.TimeFormat))
fmt.Fprintf(w, "User-agent: *\nDisallow: /")
return
}
uri, err := api.Parse(strings.TrimLeft(r.URL.Path, "/"))
if err != nil {
Respond(w, req, fmt.Sprintf("invalid URI %q", r.URL.Path), http.StatusBadRequest)