fix: SERVE_ROBOTS_TXT works again (#1229)

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso 2025-10-31 09:08:33 -04:00 committed by GitHub
parent 62c1b80189
commit 59f1e36167
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 73 additions and 0 deletions

View file

@ -345,6 +345,15 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
// Forward robots.txt requests to mux when ServeRobotsTXT is enabled
if s.opts.ServeRobotsTXT {
path := strings.TrimPrefix(r.URL.Path, anubis.BasePrefix)
if path == "/robots.txt" || path == "/.well-known/robots.txt" {
s.mux.ServeHTTP(w, r)
return
}
}
s.maybeReverseProxyOrPage(w, r)
}