From 0602293989aca45d8f2c0791273d2fcdba48342e Mon Sep 17 00:00:00 2001 From: Web-Distortion <60729517+Web-Distortion@users.noreply.github.com> Date: Tue, 19 Oct 2021 08:19:19 +0800 Subject: [PATCH] Pass through User-Agent from client Some servers may redirect clients based on their User-Agent. Fixes #66. --- proxy/proxy.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/proxy/proxy.go b/proxy/proxy.go index da10e59..b0103e2 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -138,6 +138,8 @@ func (p *Proxy) handle(w http.ResponseWriter, r *http.Request) error { return fmt.Errorf("error forwarding request: %s", err) } defer resp.Body.Close() + user_agent = r.Header().Get("User-Agent") + w.Header().Set("User-Agent", user_agent) rw := newResponseWriter(w) rr := newResponseReader(resp) err = p.proxyResponse(rw, rr, r.Header)