From 441de03fb928cc86d2976eff3977876bceb7ce6d Mon Sep 17 00:00:00 2001 From: Michael Steinert Date: Wed, 24 Dec 2014 12:59:03 -0600 Subject: [PATCH] Serve `robots.txt` from `/` This change allows `robots.txt` to be served from the root URL, i.e. https://drone.io/robots.txt, which is where [web crawlers will look for it][1]. Previously this file was only served from `/static/robots.txt`. [1]: http://www.robotstxt.org/robotstxt.html --- server/app/robots.txt | 2 +- server/main.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/app/robots.txt b/server/app/robots.txt index 4f9540ba3..7d329b1db 100644 --- a/server/app/robots.txt +++ b/server/app/robots.txt @@ -1 +1 @@ -User-agent: * \ No newline at end of file +User-agent: * diff --git a/server/main.go b/server/main.go index ee618016d..9fd47cd2b 100644 --- a/server/main.go +++ b/server/main.go @@ -137,6 +137,7 @@ func main() { // create handler for static resources assets := rice.MustFindBox("app").HTTPBox() assetserve := http.FileServer(rice.MustFindBox("app").HTTPBox()) + http.Handle("/robots.txt", assetserve) http.Handle("/static/", http.StripPrefix("/static", assetserve)) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Write(assets.MustBytes("index.html"))