From 324308f5d6d3acb59137c20fd0b34007e469d798 Mon Sep 17 00:00:00 2001 From: "Kelvin Ly (on the cloud)" Date: Fri, 19 Jul 2019 03:59:19 +0000 Subject: [PATCH] Heheheh, actually forward contents --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 2379ca1..2e9460b 100644 --- a/main.go +++ b/main.go @@ -308,7 +308,15 @@ func forwardRequest(port int, proxyScheme string) func(http.ResponseWriter, *htt } defer resp.Body.Close() - // legacy code + respHeaders := w.Header() + for h, val := range resp.Header { + respHeaders[h] = val + } + w.WriteHeader(resp.StatusCode) + _, err = io.Copy(w, resp.Body) + if err != nil { + log.Print("encountered error while forwarding copy : " + err.Error()) + } } }