mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-19 07:45:00 +02:00
Introduce ProxyRawPath flag
Setting this flag will configure the upstream proxy to pass encoded urls as-is.
This commit is contained in:
@@ -9,6 +9,10 @@ const (
|
||||
|
||||
// Upstreams is a collection of definitions for upstream servers.
|
||||
type Upstreams struct {
|
||||
// ProxyRawPath will pass the raw url path to upstream allowing for url's
|
||||
// like: "/%2F/" which would otherwise be redirected to "/"
|
||||
ProxyRawPath bool `json:"proxyRawPath,omitempty"`
|
||||
|
||||
// Upstream represents the configuration for an upstream server.
|
||||
// Requests will be proxied to this upstream if the path matches the request path.
|
||||
Configs []Upstream `json:"configs,omitempty"`
|
||||
|
||||
@@ -27,6 +27,10 @@ func NewProxy(upstreams options.Upstreams, sigData *options.SignatureData, write
|
||||
serveMux: mux.NewRouter(),
|
||||
}
|
||||
|
||||
if upstreams.ProxyRawPath {
|
||||
m.serveMux.UseEncodedPath()
|
||||
}
|
||||
|
||||
for _, upstream := range sortByPathLongest(upstreams.Configs) {
|
||||
if upstream.Static {
|
||||
if err := m.registerStaticResponseHandler(upstream, writer); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user