I built a small piece of code with the function of getting information from a website, and looks like it can't set orgin, because with curl in php, I was able to get the data with http status of 200. then I get 403. Hope everyone helps. Thank you very much
req, err:= http.NewRequest("GET", "https://immortal.hydrax.net/0/BRlsM329RNjbSqlWnRF36A4Kf5jx6qlZmoeLnJRi9A6b", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36")
req.Header.Set("Origin", "https://hydrax.net")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
fmt.Printf("%s", resp.Status)
Output : 403 Forbiddenexit
No sense to set origin because it's can't be modified programmatically. Probably your user agent header is not correct. Try this
req.Header.Set("User-Agent", `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11`)