git.iko.soy/typeable/oauth2-proxy
on master help sign in
Fix upstream proxy appending `?` to requests
025ef3eJoel Speed
CHANGELOG.md+1
@@ -16,6 +16,7 @@
16
16
17## Changes since v7.0.1
17## Changes since v7.0.1
18
18
19+- [#1115](https://github.com/oauth2-proxy/oauth2-proxy/pull/1115) Fix upstream proxy appending ? to requests (@JoelSpeed)
19- [#1117](https://github.com/oauth2-proxy/oauth2-proxy/pull/1117) Deprecate GCP HealthCheck option (@JoelSpeed)
20- [#1117](https://github.com/oauth2-proxy/oauth2-proxy/pull/1117) Deprecate GCP HealthCheck option (@JoelSpeed)
20- [#1104](https://github.com/oauth2-proxy/oauth2-proxy/pull/1104) Allow custom robots text pages (@JoelSpeed)
21- [#1104](https://github.com/oauth2-proxy/oauth2-proxy/pull/1104) Allow custom robots text pages (@JoelSpeed)
21- [#1045](https://github.com/oauth2-proxy/oauth2-proxy/pull/1045) Ensure redirect URI always has a scheme (@JoelSpeed)
22- [#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) {
153 // use RequestURI so that we aren't unescaping encoded slashes in the request path
153 // use RequestURI so that we aren't unescaping encoded slashes in the request path
154 req.URL.Opaque = req.RequestURI
154 req.URL.Opaque = req.RequestURI
155 req.URL.RawQuery = ""
155 req.URL.RawQuery = ""
156+ req.URL.ForceQuery = false
156 }
157 }
157}
158}
158
159
pkg/upstream/http_test.go+23
@@ -140,6 +140,29 @@ var _ = Describe("HTTP Upstream Suite", func() {
140 },
140 },
141 expectedUpstream: "encodedSlashes",
141 expectedUpstream: "encodedSlashes",
142 }),
142 }),
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+ }),
143 Entry("when the request has a body", &httpUpstreamTableInput{
166 Entry("when the request has a body", &httpUpstreamTableInput{
144 id: "requestWithBody",
167 id: "requestWithBody",
145 serverAddr: &serverAddr,
168 serverAddr: &serverAddr,