Skip to content

Commit

Permalink
httptransport: add unauthenticated "/robots.txt" endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <[email protected]>
  • Loading branch information
hdonnay committed Jan 31, 2024
1 parent e20dc85 commit d53408d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions httptransport/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func New(ctx context.Context, conf *config.Config, indexer indexer.Service, matc
if conf.Mode == config.ComboMode && notifier == nil {
zlog.Debug(ctx).Msg("skipping unconfigured notifier")
}
var ret http.Handler = mux
// Add endpoint authentication if configured to add auth. Must happen after
// mux was configured for given mode.
if conf.Auth.Any() {
Expand All @@ -112,9 +111,13 @@ func New(ctx context.Context, conf *config.Config, indexer indexer.Service, matc
Msg("received error configuring auth middleware")
return nil, err
}
ret = h
final := http.NewServeMux()
final.Handle("/robots.txt", robotsHandler)
final.Handle("/", h)
return final, nil
}
return ret, nil
mux.Handle("/robots.txt", robotsHandler)
return mux, nil
}

// IntraserviceIssuer is the issuer that will be used if Clair is configured to
Expand Down

0 comments on commit d53408d

Please sign in to comment.