ipn/ipnlocal: remove origin and referer headers from Taildrive requests

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>
pull/11807/head
Percy Wegmann 7 months ago committed by Percy Wegmann
parent 94c0403104
commit d16c1293e9

@ -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 {

Loading…
Cancel
Save