use gorilla/mux for routing requests

Thanks to @Fieldistor for the reminder that gorilla/mux allows you to
disable cleaning request URLs, which was causing problems with signature
verification for some URLs.

Fixes #215
Fixes #212
This commit is contained in:
Will Norris 2020-04-02 22:29:10 +00:00
parent 00652fd9cb
commit 3589510f2c
3 changed files with 6 additions and 2 deletions

View file

@ -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