req icon indicating copy to clipboard operation
req copied to clipboard

设置了代理, 但连接的是本地.

Open kaylee595 opened this issue 5 months ago • 0 comments

使用下面代码创建的客户端, 在并发的时候, 会出现部分请求走到本地的情况:

	client := req.C().SetProxyURL("http://localhost:9000").DisableKeepAlives().
		SetUserAgent("curl")

我怀疑可能是重试导致的问题, 于是我使用下面的代码可以解决问题:

	client := req.C().SetProxyURL("http://localhost:9000").DisableKeepAlives().
		SetUserAgent("curl").SetCommonRetryCondition(func(_ *req.Response, _ error) bool {
		return false
	})

kaylee595 avatar Jul 01 '25 06:07 kaylee595