added path replacement rule
This commit is contained in:
parent
5a8215a1e4
commit
aa8375e82b
5 changed files with 82 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue