diff --git a/cluster.go b/cluster.go index ea2a476..a5a2df6 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)