(w http.ResponseWriter, r *http.Request)
| 337 | } |
| 338 | |
| 339 | func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 340 | if strings.HasPrefix(r.URL.Path, anubis.BasePrefix+anubis.StaticPath) { |
| 341 | s.mux.ServeHTTP(w, r) |
| 342 | return |
| 343 | } else if strings.HasPrefix(r.URL.Path, anubis.BasePrefix+xess.BasePrefix) { |
| 344 | s.mux.ServeHTTP(w, r) |
| 345 | return |
| 346 | } |
| 347 | |
| 348 | // Forward robots.txt requests to mux when ServeRobotsTXT is enabled |
| 349 | if s.opts.ServeRobotsTXT { |
| 350 | path := strings.TrimPrefix(r.URL.Path, anubis.BasePrefix) |
| 351 | if path == "/robots.txt" || path == "/.well-known/robots.txt" { |
| 352 | s.mux.ServeHTTP(w, r) |
| 353 | return |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | s.maybeReverseProxyOrPage(w, r) |
| 358 | } |
| 359 | |
| 360 | func (s *Server) stripBasePrefixFromRequest(r *http.Request) *http.Request { |
| 361 | if !s.opts.StripBasePrefix || s.opts.BasePrefix == "" { |
no test coverage detected