Skip to content

Commit 235897b

Browse files
committed
AUTH-3426: Point to new transfer service URL and eliminate PUT /ok
1 parent bf737a0 commit 235897b

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

cmd/cloudflared/tunnel/login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020

2121
const (
2222
baseLoginURL = "https://dash.cloudflare.com/argotunnel"
23-
callbackStoreURL = "https://login.argotunnel.com/"
23+
callbackStoreURL = "https://login.cloudflareaccess.org/"
2424
)
2525

2626
func buildLoginSubcommand(hidden bool) *cli.Command {

token/transfer.go

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
const (
18-
baseStoreURL = "https://login.argotunnel.com/"
18+
baseStoreURL = "https://login.cloudflareaccess.org/"
1919
clientTimeout = time.Second * 60
2020
)
2121

@@ -83,11 +83,13 @@ func buildRequestURL(baseURL *url.URL, key, value string, cli, useHostOnly bool)
8383
if useHostOnly {
8484
baseURL.Path = ""
8585
}
86+
// TODO: pass arg for tunnel login
8687
if !cli {
8788
return baseURL.String(), nil
8889
}
8990
q.Set("redirect_url", baseURL.String()) // we add the token as a query param on both the redirect_url and the main url
9091
q.Set("send_org_token", "true") // indicates that the cli endpoint should return both the org and app token
92+
q.Set("edge_token_transfer", "true") // use new LoginHelper service built on workers
9193
baseURL.RawQuery = q.Encode() // and this actual baseURL.
9294
baseURL.Path = "cdn-cgi/access/cli"
9395
return baseURL.String(), nil
@@ -103,9 +105,6 @@ func transferRequest(requestURL string, log *zerolog.Logger) ([]byte, string, er
103105
if err != nil {
104106
return nil, "", err
105107
} else if len(buf) > 0 {
106-
if err := putSuccess(client, requestURL); err != nil {
107-
log.Err(err).Msg("Failed to update resource success")
108-
}
109108
return buf, key, nil
110109
}
111110
}
@@ -136,22 +135,3 @@ func poll(client *http.Client, requestURL string, log *zerolog.Logger) ([]byte,
136135
}
137136
return buf.Bytes(), resp.Header.Get("service-public-key"), nil
138137
}
139-
140-
// putSuccess tells the server we successfully downloaded the resource
141-
func putSuccess(client *http.Client, requestURL string) error {
142-
req, err := http.NewRequest("PUT", requestURL+"/ok", nil)
143-
if err != nil {
144-
return err
145-
}
146-
147-
resp, err := client.Do(req)
148-
if err != nil {
149-
return err
150-
}
151-
152-
resp.Body.Close()
153-
if resp.StatusCode != 200 {
154-
return fmt.Errorf("HTTP Response Status Code: %d", resp.StatusCode)
155-
}
156-
return nil
157-
}

0 commit comments

Comments
 (0)