I can use curl
to send my request successfully, but golang seems impossible to do.
curl -H 'Host: aaa.com' 'http://bbb.com'
My question is: how I can send request with host which is different with host in url?
I can use curl
to send my request successfully, but golang seems impossible to do.
curl -H 'Host: aaa.com' 'http://bbb.com'
My question is: how I can send request with host which is different with host in url?
Set Request.Host to change the host header sent to the server.
req, err := http.NewRequest("GET", "http://bbb.com/", nil)
if err != nil {
log.Fatal(err)
}
req.Host = "aaa.com"