mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
Merge pull request #402 from aquiladev/swarm-network-rewrite
swarm: adds handling GET robots.txt #154 (our default is to disallow crawling, but this can be overwritten using nginx config)
This commit is contained in:
commit
068ad8e71f
1 changed files with 6 additions and 0 deletions
|
|
@ -850,6 +850,12 @@ func (s *Server) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
return
|
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, "/"))
|
uri, err := api.Parse(strings.TrimLeft(r.URL.Path, "/"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Respond(w, req, fmt.Sprintf("invalid URI %q", r.URL.Path), http.StatusBadRequest)
|
Respond(w, req, fmt.Sprintf("invalid URI %q", r.URL.Path), http.StatusBadRequest)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue