1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-06 23:46:28 +02:00

Fix upstream proxy appending ? to requests

This commit is contained in:
Joel Speed 2021-03-21 11:10:12 +00:00
parent f0963b3444
commit 025ef3eca4
No known key found for this signature in database
GPG Key ID: 6E80578D6751DEFB
3 changed files with 25 additions and 0 deletions

View File

@ -16,6 +16,7 @@
## Changes since v7.0.1 ## Changes since v7.0.1
- [#1115](https://github.com/oauth2-proxy/oauth2-proxy/pull/1115) Fix upstream proxy appending ? to requests (@JoelSpeed)
- [#1117](https://github.com/oauth2-proxy/oauth2-proxy/pull/1117) Deprecate GCP HealthCheck option (@JoelSpeed) - [#1117](https://github.com/oauth2-proxy/oauth2-proxy/pull/1117) Deprecate GCP HealthCheck option (@JoelSpeed)
- [#1104](https://github.com/oauth2-proxy/oauth2-proxy/pull/1104) Allow custom robots text pages (@JoelSpeed) - [#1104](https://github.com/oauth2-proxy/oauth2-proxy/pull/1104) Allow custom robots text pages (@JoelSpeed)
- [#1045](https://github.com/oauth2-proxy/oauth2-proxy/pull/1045) Ensure redirect URI always has a scheme (@JoelSpeed) - [#1045](https://github.com/oauth2-proxy/oauth2-proxy/pull/1045) Ensure redirect URI always has a scheme (@JoelSpeed)

View File

@ -153,6 +153,7 @@ func setProxyDirector(proxy *httputil.ReverseProxy) {
// use RequestURI so that we aren't unescaping encoded slashes in the request path // use RequestURI so that we aren't unescaping encoded slashes in the request path
req.URL.Opaque = req.RequestURI req.URL.Opaque = req.RequestURI
req.URL.RawQuery = "" req.URL.RawQuery = ""
req.URL.ForceQuery = false
} }
} }

View File

@ -140,6 +140,29 @@ var _ = Describe("HTTP Upstream Suite", func() {
}, },
expectedUpstream: "encodedSlashes", expectedUpstream: "encodedSlashes",
}), }),
Entry("request a path with an empty query string", &httpUpstreamTableInput{
id: "default",
serverAddr: &serverAddr,
target: "http://example.localhost/foo?",
method: "GET",
body: []byte{},
errorHandler: nil,
expectedResponse: testHTTPResponse{
code: 200,
header: map[string][]string{
contentType: {applicationJSON},
},
request: testHTTPRequest{
Method: "GET",
URL: "http://example.localhost/foo?",
Header: map[string][]string{},
Body: []byte{},
Host: "example.localhost",
RequestURI: "http://example.localhost/foo?",
},
},
expectedUpstream: "default",
}),
Entry("when the request has a body", &httpUpstreamTableInput{ Entry("when the request has a body", &httpUpstreamTableInput{
id: "requestWithBody", id: "requestWithBody",
serverAddr: &serverAddr, serverAddr: &serverAddr,