git.iko.soy/typeable/oauth2-proxy
on master help sign in
Fix upstream proxy appending `?` to requests
commit025ef3eca4a83ea4127c50fd7d43784b2314933a authorJoel Speed <joel.speed@hotmail.co.uk> dateSun 21 Mar 2021, 11:10 (6 years ago) parentf0963b3
3 files changed+25
CHANGELOG.md+1 pkg/upstream/http.go+1 pkg/upstream/http_test.go+23
CHANGELOG.md+1
@@ -16,6 +16,7 @@
1616
1717## Changes since v7.0.1
1818
19+- [#1115](https://github.com/oauth2-proxy/oauth2-proxy/pull/1115) Fix upstream proxy appending ? to requests (@JoelSpeed)
1920- [#1117](https://github.com/oauth2-proxy/oauth2-proxy/pull/1117) Deprecate GCP HealthCheck option (@JoelSpeed)
2021- [#1104](https://github.com/oauth2-proxy/oauth2-proxy/pull/1104) Allow custom robots text pages (@JoelSpeed)
2122- [#1045](https://github.com/oauth2-proxy/oauth2-proxy/pull/1045) Ensure redirect URI always has a scheme (@JoelSpeed)
pkg/upstream/http.go+1
@@ -153,6 +153,7 @@ func setProxyDirector(proxy *httputil.ReverseProxy) {
153153 // use RequestURI so that we aren't unescaping encoded slashes in the request path
154154 req.URL.Opaque = req.RequestURI
155155 req.URL.RawQuery = ""
156+ req.URL.ForceQuery = false
156157 }
157158}
158159
pkg/upstream/http_test.go+23
@@ -140,6 +140,29 @@ var _ = Describe("HTTP Upstream Suite", func() {
140140 },
141141 expectedUpstream: "encodedSlashes",
142142 }),
143+ Entry("request a path with an empty query string", &httpUpstreamTableInput{
144+ id: "default",
145+ serverAddr: &serverAddr,
146+ target: "http://example.localhost/foo?",
147+ method: "GET",
148+ body: []byte{},
149+ errorHandler: nil,
150+ expectedResponse: testHTTPResponse{
151+ code: 200,
152+ header: map[string][]string{
153+ contentType: {applicationJSON},
154+ },
155+ request: testHTTPRequest{
156+ Method: "GET",
157+ URL: "http://example.localhost/foo?",
158+ Header: map[string][]string{},
159+ Body: []byte{},
160+ Host: "example.localhost",
161+ RequestURI: "http://example.localhost/foo?",
162+ },
163+ },
164+ expectedUpstream: "default",
165+ }),
143166 Entry("when the request has a body", &httpUpstreamTableInput{
144167 id: "requestWithBody",
145168 serverAddr: &serverAddr,