Recently, while working on goeland, I ran some test on reddit’s RSS feeds.

While it worked fine in the past, in the last few months with update to golang 1.17, people started complaining that reddit was rejecting their requests. While if you do the same request with curl, it works, with golang you would get a 429 error code.

The solution outlined on reddit was alike:

req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("User-Agent", "Custom Agent")
var defaultClient = http.Client{
    Transport: &http.Transport{
	TLSNextProto: map[string]func(authority string, c *tls.Conn) http.RoundTripper{},
    },
}
resp, _ := defaultClient.Do(req)