From 861854245b25e4993c36758f5add552f5440d64e Mon Sep 17 00:00:00 2001 From: Konstantin Astafurov Date: Fri, 26 Jan 2024 12:15:33 -0500 Subject: [PATCH 1/2] Update to go 1.21 The change to reverseproxy.go to make tests pass came from @marsam on GitHub. --- Dockerfile | 2 +- go.mod | 2 +- reverseproxy/reverseproxy.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index dfbf5fe..e302373 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.18.3-alpine WORKDIR /go/src/github.com/suyashkumar/ssl-proxy RUN apk add --no-cache make git zip -RUN go get -u github.com/golang/dep/cmd/dep COPY . . +RUN go get -u github.com/golang/dep/cmd/dep RUN make diff --git a/go.mod b/go.mod index ebf9da3..f4061c8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/suyashkumar/ssl-proxy -go 1.18 +go 1.21 require ( github.com/stretchr/testify v1.7.0 diff --git a/reverseproxy/reverseproxy.go b/reverseproxy/reverseproxy.go index fcd0fc8..5ce954c 100644 --- a/reverseproxy/reverseproxy.go +++ b/reverseproxy/reverseproxy.go @@ -32,7 +32,7 @@ func newDirector(target *url.URL, extraDirector func(*http.Request)) func(*http. } else { req.URL.RawQuery = targetQuery + "&" + req.URL.RawQuery } - if _, ok := req.Header["User-Agent"]; !ok { + if req.Header.Get("User-Agent") != "" { // explicitly disable User-Agent so it's not set to default value req.Header.Set("User-Agent", "") } From fd32a2428123c2a72693a0f487a95d723e51ad32 Mon Sep 17 00:00:00 2001 From: Konstantin Astafurov Date: Mon, 5 Feb 2024 17:51:50 -0500 Subject: [PATCH 2/2] Remove redundant code block, update gh workflow to go 1.21 --- .github/workflows/go.yml | 4 ++-- reverseproxy/reverseproxy.go | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 16607bb..69ec918 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,10 +7,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.18 + - name: Set up Go 1.21 uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: 1.21 id: go - name: Check out code into the Go module directory diff --git a/reverseproxy/reverseproxy.go b/reverseproxy/reverseproxy.go index 5ce954c..42a6f27 100644 --- a/reverseproxy/reverseproxy.go +++ b/reverseproxy/reverseproxy.go @@ -32,11 +32,6 @@ func newDirector(target *url.URL, extraDirector func(*http.Request)) func(*http. } else { req.URL.RawQuery = targetQuery + "&" + req.URL.RawQuery } - if req.Header.Get("User-Agent") != "" { - // explicitly disable User-Agent so it's not set to default value - req.Header.Set("User-Agent", "") - } - if extraDirector != nil { extraDirector(req) }