Skip to content

Commit

Permalink
Merge pull request #189 from kcajmagic/fix/188/send_headers
Browse files Browse the repository at this point in the history
fix(#188): add headers from original request to redirects
  • Loading branch information
schmidtw authored Jul 12, 2024
2 parents e49b14c + 7b00123 commit 173fb28
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/websocket/ws.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,15 @@ func (ws *Websocket) newHTTPClient(mode ipMode) (*http.Client, error) {
return nil, err
}

// update client redirect to send all headers on subsequent requests
client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
// Copy headers from the first request to original requests
for key, value := range via[0].Header {
req.Header[key] = value
}
return nil
}

// Override config.NewClient()'s Transport and update it's DialContext with the provided mode.
transport, err := config.Transport.NewTransport(config.TLS)
if err != nil {
Expand Down

0 comments on commit 173fb28

Please sign in to comment.