Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom HTTP headers for CONNECT proxy request #479

Open
aus opened this issue Feb 9, 2019 · 2 comments · May be fixed by #605
Open

Support custom HTTP headers for CONNECT proxy request #479

aus opened this issue Feb 9, 2019 · 2 comments · May be fixed by #605

Comments

@aus
Copy link

aus commented Feb 9, 2019

When an HTTP proxy is used, there is no way to customize the headers in the initial CONNECT request. In some situations, a HTTP proxy may require certain User-Agents or other headers. golang added support for this in net/http in 1.8. The golang issue is documented here with support added in 1.8 as documented here.

Note, this is not the same as providing a requestHeader to Conn.NewClient or Dialer.Dial. These headers are only present after the initial CONNECT request to the HTTP proxy.

@garyburd
Copy link
Contributor

Fix this issue by adding a ProxyConnectHeader to Dialer and use this header connecting through a proxy.

@Fenny
Copy link

Fenny commented Dec 9, 2019

Untill this feature gets properly implemented into the main branch, you can use my version.
https://github.com/fenny/websocket

dialer := websocket.Dialer{
  Proxy: http.ProxyURL(&url.URL{
    Scheme: "http",
    Host: "127.0.0.1:6969",
    Path: "/",
  }),
  ProxyConnectHeaders: map[string]string{
    "Proxy-Auth": "user:pass",
    "Proxy-Geo":  "EU",
  },
}

AllenX2018 pushed a commit to AllenX2018/websocket that referenced this issue Jun 15, 2020
AllenX2018 pushed a commit to AllenX2018/websocket that referenced this issue Jun 15, 2020
@AllenX2018 AllenX2018 linked a pull request Jun 29, 2020 that will close this issue
AllenX2018 added a commit to AllenX2018/websocket that referenced this issue Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In progress
Development

Successfully merging a pull request may close this issue.

5 participants