Skip to content

Commit

Permalink
remove Referer header
Browse files Browse the repository at this point in the history
fix #73
  • Loading branch information
zyxkad committed Oct 9, 2024
1 parent dd8238d commit 1865ea3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ func NewCluster(

client: &http.Client{
Transport: transport,
CheckRedirect: redirectChecker,
},
cachedCli: &http.Client{
Transport: cachedTransport,
CheckRedirect: redirectChecker,
},

wsUpgrader: &websocket.Upgrader{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1865ea3

Please sign in to comment.