mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-01 11:26:29 +02:00
Merge pull request #310 from desimone/bug/262
proxy: handle double slash in paths
This commit is contained in:
commit
cfeb5e1ef9
4 changed files with 7 additions and 1 deletions
|
@ -118,6 +118,7 @@ func newProxyService(opt config.Options, r *mux.Router) (*proxy.Proxy, error) {
|
||||||
|
|
||||||
func newGlobalRouter(o *config.Options) *mux.Router {
|
func newGlobalRouter(o *config.Options) *mux.Router {
|
||||||
mux := httputil.NewRouter()
|
mux := httputil.NewRouter()
|
||||||
|
mux.SkipClean(true)
|
||||||
mux.Use(metrics.HTTPMetricsHandler(o.Services))
|
mux.Use(metrics.HTTPMetricsHandler(o.Services))
|
||||||
mux.Use(log.NewHandler(log.Logger))
|
mux.Use(log.NewHandler(log.Logger))
|
||||||
mux.Use(log.AccessHandler(func(r *http.Request, status, size int, duration time.Duration) {
|
mux.Use(log.AccessHandler(func(r *http.Request, status, size int, duration time.Duration) {
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed an issue where CSRF would fail if multiple tabs were open. [GH-306](https://github.com/pomerium/pomerium/issues/306)
|
- Fixed an issue where CSRF would fail if multiple tabs were open. [GH-306](https://github.com/pomerium/pomerium/issues/306)
|
||||||
|
- Fixed an issue where pomerium would clean double slashes from paths.[GH-262](https://github.com/pomerium/pomerium/issues/262)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,9 @@ import (
|
||||||
|
|
||||||
// Handler returns the proxy service's ServeMux
|
// Handler returns the proxy service's ServeMux
|
||||||
func (p *Proxy) Handler() http.Handler {
|
func (p *Proxy) Handler() http.Handler {
|
||||||
r := httputil.NewRouter().StrictSlash(true)
|
r := httputil.NewRouter()
|
||||||
|
r.SkipClean(true)
|
||||||
|
r.StrictSlash(true)
|
||||||
r.Use(middleware.ValidateHost(func(host string) bool {
|
r.Use(middleware.ValidateHost(func(host string) bool {
|
||||||
_, ok := p.routeConfigs[host]
|
_, ok := p.routeConfigs[host]
|
||||||
return ok
|
return ok
|
||||||
|
|
|
@ -247,6 +247,8 @@ func NewReverseProxy(to *url.URL) *httputil.ReverseProxy {
|
||||||
// each route has a custom set of middleware applied to the reverse proxy
|
// each route has a custom set of middleware applied to the reverse proxy
|
||||||
func (p *Proxy) newReverseProxyHandler(rp http.Handler, route *config.Policy) (http.Handler, error) {
|
func (p *Proxy) newReverseProxyHandler(rp http.Handler, route *config.Policy) (http.Handler, error) {
|
||||||
r := pom_httputil.NewRouter()
|
r := pom_httputil.NewRouter()
|
||||||
|
r.SkipClean(true)
|
||||||
|
r.StrictSlash(true)
|
||||||
r.Use(middleware.StripPomeriumCookie(p.cookieName))
|
r.Use(middleware.StripPomeriumCookie(p.cookieName))
|
||||||
// if signing key is set, add signer to middleware
|
// if signing key is set, add signer to middleware
|
||||||
if len(p.signingKey) != 0 {
|
if len(p.signingKey) != 0 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue