Home > other >  Making an authenticated proxy request with Go?
Making an authenticated proxy request with Go?

Time:04-18

I basically have a proxy that has a username and password. I was wondering how to make an HTTP request with the library net/http, but with an HTTP proxy with authentication.

Thank you!

CodePudding user response:

What about something like

&http.Client{
  Transport: &http.Transport{
    Proxy: http.ProxyURL(&url.URL{
      Scheme: "http",
      User:   url.UserPassword("login", "password"),
      Host:   "IP:PORT",
    }),
  },
}
  • Related