lib/http: Add auth to http service

Fixes https://github.com/rclone/rclone/issues/5620
This commit is contained in:
Nolan Woods 2021-09-24 11:17:27 -07:00 committed by Nick Craig-Wood
parent 26b6c83e49
commit b30731c9d0
1 changed files with 3 additions and 0 deletions

View File

@ -96,6 +96,9 @@ func newServer(f fs.Fs, templatePath string) *server {
}
func (s *server) Bind(router chi.Router) {
if m := auth.Auth(auth.Opt); m != nil {
router.Use(m)
}
router.Use(
middleware.SetHeader("Accept-Ranges", "bytes"),
middleware.SetHeader("Server", "rclone/"+fs.Version),