在mac环境中使用代理是好的,但在linux环境中报告了错误页面加载错误net::ERR_TIMED_OUT


opts := append(chromedp.DefaultExecAllocatorOptions[:], chromedp.Flag("headless", true))
if ip != "" {
opts = append(opts, chromedp.ProxyServer(ip))
}
alloctx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
defer cancel()
ctx, cancel := chromedp.NewContext(alloctx,
chromedp.WithLogf(log.Printf),
)

它可以在mac中正常代理,但在linux中报告错误提示:页面加载错误网络::ERR_TIMED_OUT带代理ip

运行应用程序的服务器很可能无法连接到代理服务器(因为您使用调用chromedp.NewExecAllocator,所以它与运行浏览器的服务器相同(。请检查服务器和代理之间的网络连接。

如果您认为网络没有任何问题,请提供完整的演示来显示该问题。描述代理是如何设置的会很有帮助,这样其他人就可以重现这个问题。

最新更新