Skip to content

Commit

Permalink
Merge pull request ethereum#402 from aquiladev/swarm-network-rewrite
Browse files Browse the repository at this point in the history
swarm: adds handling GET robots.txt ethereum#154 (our default is to disallow crawling, but this can be overwritten using nginx config)
  • Loading branch information
Aron authored Apr 19, 2018
2 parents 5f33e9a + f0de54e commit 068ad8e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions swarm/api/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,12 @@ func (s *Server) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
return
}

if r.URL.Path == "/robots.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)
Expand Down

0 comments on commit 068ad8e

Please sign in to comment.