added path replacement rule

This commit is contained in:
ssttevee 2017-04-25 11:13:39 -07:00
parent 5a8215a1e4
commit aa8375e82b
5 changed files with 82 additions and 0 deletions

View file

@ -65,6 +65,7 @@ type serverRoute struct {
route *mux.Route
stripPrefixes []string
addPrefix string
replacePath string
}
// NewServer returns an initialized Server.
@ -806,6 +807,14 @@ func (server *Server) wireFrontendBackend(serverRoute *serverRoute, handler http
}
}
// path replace
if len(serverRoute.replacePath) > 0 {
handler = &middlewares.ReplacePath{
Path: serverRoute.replacePath,
Handler: handler,
}
}
serverRoute.route.Handler(handler)
}