mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-06-02 23:27:22 +02:00
WIP: Fix proxy mapping to upstreams
This commit is contained in:
parent
ad2d7b1ae7
commit
4bea9948f7
@ -40,9 +40,6 @@ var SignatureHeaders = []string{
|
|||||||
// newHTTPUpstreamProxy creates a new httpUpstreamProxy that can serve requests
|
// newHTTPUpstreamProxy creates a new httpUpstreamProxy that can serve requests
|
||||||
// to a single upstream host.
|
// to a single upstream host.
|
||||||
func newHTTPUpstreamProxy(upstream options.Upstream, u *url.URL, sigData *options.SignatureData, errorHandler ProxyErrorHandler) http.Handler {
|
func newHTTPUpstreamProxy(upstream options.Upstream, u *url.URL, sigData *options.SignatureData, errorHandler ProxyErrorHandler) http.Handler {
|
||||||
// Set path to empty so that request paths start at the server root
|
|
||||||
u.Path = ""
|
|
||||||
|
|
||||||
// Create a ReverseProxy
|
// Create a ReverseProxy
|
||||||
proxy := newReverseProxy(u, upstream, errorHandler)
|
proxy := newReverseProxy(u, upstream, errorHandler)
|
||||||
|
|
||||||
|
@ -54,6 +54,11 @@ var _ = Describe("Proxy Suite", func() {
|
|||||||
Static: true,
|
Static: true,
|
||||||
StaticCode: &ok,
|
StaticCode: &ok,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ID: "http-backend-with-subpath",
|
||||||
|
Path: "/http-subpath/",
|
||||||
|
URI: fmt.Sprintf("%s/subpath/", serverAddr),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
@ -179,5 +184,26 @@ var _ = Describe("Proxy Suite", func() {
|
|||||||
raw: "404 page not found\n",
|
raw: "404 page not found\n",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
Entry("with a request to the HTTP service registered under a subpath", &proxyTableInput{
|
||||||
|
target: "http://example.localhost/http-subpath/1234",
|
||||||
|
response: testHTTPResponse{
|
||||||
|
code: 200,
|
||||||
|
header: map[string][]string{
|
||||||
|
gapUpstream: {"http-backend-with-subpath"},
|
||||||
|
contentType: {applicationJSON},
|
||||||
|
},
|
||||||
|
request: testHTTPRequest{
|
||||||
|
Method: "GET",
|
||||||
|
URL: "http://example.localhost/subpath/http-subpath/1234",
|
||||||
|
Header: map[string][]string{
|
||||||
|
"Gap-Auth": {""},
|
||||||
|
"Gap-Signature": {"sha256 ofB1u6+FhEUbFLc3/uGbJVkl7GaN4egFqVvyO3+2I1w="},
|
||||||
|
},
|
||||||
|
Body: []byte{},
|
||||||
|
Host: "example.localhost",
|
||||||
|
RequestURI: "http://example.localhost/subpath/http-subpath/1234",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user