diff --git a/cmd/imageproxy/main.go b/cmd/imageproxy/main.go index 2b8cc1d59..14b0b8bf1 100644 --- a/cmd/imageproxy/main.go +++ b/cmd/imageproxy/main.go @@ -31,6 +31,7 @@ import ( "github.com/die-net/lrucache" "github.com/die-net/lrucache/twotier" "github.com/garyburd/redigo/redis" + "github.com/gorilla/mux" "github.com/gregjones/httpcache/diskcache" rediscache "github.com/gregjones/httpcache/redis" "github.com/jamiealquiza/envy" @@ -99,9 +100,10 @@ func main() { Handler: p, } + r := mux.NewRouter().SkipClean(true).UseEncodedPath() + r.PathPrefix("/").Handler(p) fmt.Printf("imageproxy listening on %s\n", server.Addr) - http.Handle("/", p) - log.Fatal(http.ListenAndServe(*addr, nil)) + log.Fatal(http.ListenAndServe(*addr, r)) } type signatureKeyList [][]byte diff --git a/go.mod b/go.mod index c78a7a820..d4931de56 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( github.com/garyburd/redigo v1.6.0 github.com/gomodule/redigo v2.0.0+incompatible // indirect github.com/google/btree v1.0.0 // indirect + github.com/gorilla/mux v1.6.2 github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc github.com/grpc-ecosystem/grpc-gateway v1.8.5 // indirect github.com/hashicorp/golang-lru v0.5.1 // indirect diff --git a/go.sum b/go.sum index 879e2d9b8..7ac7d9a26 100644 --- a/go.sum +++ b/go.sum @@ -94,6 +94,7 @@ github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk github.com/googleapis/gax-go/v2 v2.0.4 h1:hU4mGcQI4DaAYW+IbTun+2qEZVFxK0ySjQLTbS0VQKc= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc h1:f8eY6cV/x1x+HLjOp4r72s/31/V2aTUtg5oKRRPf8/Q=