feat: customize proxy ignore headers (close #2763 pr #2766)

* clean referer when use proxy

* feat: customize proxy ignore headers

Co-authored-by: Noah Hsu <i@nn.ci>
This commit is contained in:
EzraRT
2022-12-20 16:08:32 +08:00
committed by GitHub
parent 372030071e
commit 146619134d
7 changed files with 30 additions and 29 deletions

View File

@ -10,7 +10,9 @@ import (
"strconv"
"strings"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
)
@ -67,7 +69,7 @@ func Proxy(w http.ResponseWriter, r *http.Request, link *model.Link, file model.
return err
}
for h, val := range r.Header {
if strings.ToLower(h) == "authorization" {
if utils.SliceContains(conf.SlicesMap[conf.ProxyIgnoreHeaders], strings.ToLower(h)) {
continue
}
req.Header[h] = val