From 1865ea39be4ce97b3d2a07ee5e21199d56864f4b Mon Sep 17 00:00:00 2001 From: zyxkad Date: Wed, 9 Oct 2024 11:56:15 -0600 Subject: [PATCH] remove Referer header fix #73 --- cluster.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cluster.go b/cluster.go index ea2a476b..a5a2df67 100644 --- a/cluster.go +++ b/cluster.go @@ -159,9 +159,11 @@ func NewCluster( client: &http.Client{ Transport: transport, + CheckRedirect: redirectChecker, }, cachedCli: &http.Client{ Transport: cachedTransport, + CheckRedirect: redirectChecker, }, wsUpgrader: &websocket.Upgrader{ @@ -193,6 +195,14 @@ func NewCluster( return } +func redirectChecker(req *http.Request, via []*http.Request) error { + req.Header.Del("Referer") + if len(via) > 10 { + return errors.New("More than 10 redirects detected") + } + return nil +} + func (cr *Cluster) Init(ctx context.Context) (err error) { // create data folder os.MkdirAll(cr.dataDir, 0755)