github.com/webonyx/up@v0.7.4-0.20180808230834-91b94e551323/http/robots/robots.go (about) 1 // Package robots provides a way of dealing with robots exclusion protocol 2 package robots 3 4 import ( 5 "net/http" 6 "os" 7 8 "github.com/apex/up" 9 ) 10 11 // New robots middleware. 12 func New(c *up.Config, next http.Handler) http.Handler { 13 if os.Getenv("UP_STAGE") == "production" { 14 return next 15 } 16 17 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 18 w.Header().Set("X-Robots-Tag", "none") 19 next.ServeHTTP(w, r) 20 }) 21 }