@@ -21,6 +21,7 @@ import (
2121 "github.com/bitly/google_auth_proxy/providers"
2222)
2323
24+const robotsPath = "/robots.txt"
2425const pingPath = "/ping"
2526const signInPath = "/oauth2/sign_in"
2627const oauthStartPath = "/oauth2/start"
@@ -270,6 +271,11 @@ func (p *OauthProxy) SetCookie(rw http.ResponseWriter, req *http.Request, val st
270271 http.SetCookie(rw, cookie)
271272}
272273
274+func (p *OauthProxy) RobotsTxt(rw http.ResponseWriter) {
275+ rw.WriteHeader(http.StatusOK)
276+ fmt.Fprintf(rw, "User-agent: *\nDisallow: /")
277+}
278+
273279func (p *OauthProxy) PingPage(rw http.ResponseWriter) {
274280 rw.WriteHeader(http.StatusOK)
275281 fmt.Fprintf(rw, "OK")
@@ -358,6 +364,11 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
358364 var email string
359365 var access_token string
360366
367+ if req.URL.Path == robotsPath {
368+ p.RobotsTxt(rw)
369+ return
370+ }
371+
361372 if req.URL.Path == pingPath {
362373 p.PingPage(rw)
363374 return