AUTH-1320: Fixed request issue and unhide the ssh command

This commit is contained in:
Austin Cherry
2018-11-15 13:08:56 -06:00
parent c2ac282aca
commit f49d9dcb67
2 changed files with 11 additions and 6 deletions

View File

@@ -89,6 +89,7 @@ func createWebsocketStream(originURL string) (*websocket.Conn, error) {
if err != nil {
return nil, err
}
wsConn, resp, err := websocket.ClientConnect(req, nil)
if err != nil && resp != nil && resp.StatusCode > 300 {
location, err := resp.Location()
@@ -125,7 +126,14 @@ func buildAccessRequest(originURL string) (*http.Request, error) {
if err != nil {
return nil, err
}
req.Header.Set("cf-access-token", token)
return req, nil
// We need to create a new request as FetchToken will modify req (boo mutable)
// as it has to follow redirect on the API and such, so here we init a new one
originRequest, err := http.NewRequest(http.MethodGet, originURL, nil)
if err != nil {
return nil, err
}
originRequest.Header.Set("cf-access-token", token)
return originRequest, nil
}