Add multiple rules

Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
Emile Vauge 2016-04-06 13:06:31 +02:00
parent ef72d355d6
commit 8486766a60
No known key found for this signature in database
GPG key ID: D808B4C167352E59
3 changed files with 78 additions and 31 deletions

View file

@ -57,8 +57,8 @@ type serverEntryPoint struct {
}
type serverRoute struct {
route *mux.Route
stripPrefix string
route *mux.Route
stripPrefixes []string
}
// NewServer returns an initialized Server.
@ -471,10 +471,10 @@ func (server *Server) loadConfig(configurations configs, globalConfiguration Glo
func (server *Server) wireFrontendBackend(serverRoute *serverRoute, handler http.Handler) {
// strip prefix
if len(serverRoute.stripPrefix) > 0 {
if len(serverRoute.stripPrefixes) > 0 {
serverRoute.route.Handler(&middlewares.StripPrefix{
Prefix: serverRoute.stripPrefix,
Handler: handler,
Prefixes: serverRoute.stripPrefixes,
Handler: handler,
})
} else {
serverRoute.route.Handler(handler)