Skip to content

Commit

Permalink
ipn/ipnlocal: remove origin and referer headers from Taildrive requests
Browse files Browse the repository at this point in the history
peerapi does not want these, but rclone includes them.
Removing them allows rclone to work with Taildrive configured
as a WebDAV remote.

Updates #cleanup

Signed-off-by: Percy Wegmann <percy@tailscale.com>
  • Loading branch information
oxtoacart committed Apr 18, 2024
1 parent 94c0403 commit d16c129
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ipn/ipnlocal/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -4827,16 +4827,17 @@ func (rbw *responseBodyWrapper) Close() error {
}

func (dt *driveTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
// Some WebDAV clients include origin and refer headers, which peerapi does
// not like. Remove them.
req.Header.Del("origin")
req.Header.Del("referer")

bw := &requestBodyWrapper{}
if req.Body != nil {
bw.ReadCloser = req.Body
req.Body = bw
}

// Strip origin and referer headers
req.Header.Del("origin")
req.Header.Del("referer")

defer func() {
contentType := "unknown"
switch req.Method {
Expand Down

0 comments on commit d16c129

Please sign in to comment.