Disable gorilla/mux URL cleaning to prevent sending redirect

This fixes #167 and #651. By default, gorilla/mux cleans URL paths
such that adjacent slashes are collapsed into one single slash. This
behavior is pretty common in application stacks and it is fine, but
for Traefik, this can lead to incorrect URL paths forwarded to backend
servers.

See https://github.com/gorilla/mux/issues/94 for background.
This commit is contained in:
Yoann Dubreuil 2016-09-20 16:43:09 +02:00
parent 7e8937a332
commit 82cb21fca3

View file

@ -668,6 +668,7 @@ func (server *Server) buildDefaultHTTPRouter() *mux.Router {
router := mux.NewRouter()
router.NotFoundHandler = http.HandlerFunc(notFoundHandler)
router.StrictSlash(true)
router.SkipClean(true)
return router
}