Fix regex with PathStrip
This commit is contained in:
parent
74925ba996
commit
bf3673879f
5 changed files with 156 additions and 17 deletions
|
@ -62,10 +62,11 @@ type serverEntryPoint struct {
|
|||
}
|
||||
|
||||
type serverRoute struct {
|
||||
route *mux.Route
|
||||
stripPrefixes []string
|
||||
addPrefix string
|
||||
replacePath string
|
||||
route *mux.Route
|
||||
stripPrefixes []string
|
||||
stripPrefixesRegex []string
|
||||
addPrefix string
|
||||
replacePath string
|
||||
}
|
||||
|
||||
// NewServer returns an initialized Server.
|
||||
|
@ -807,6 +808,11 @@ func (server *Server) wireFrontendBackend(serverRoute *serverRoute, handler http
|
|||
}
|
||||
}
|
||||
|
||||
// strip prefix with regex
|
||||
if len(serverRoute.stripPrefixesRegex) > 0 {
|
||||
handler = middlewares.NewStripPrefixRegex(handler, serverRoute.stripPrefixesRegex)
|
||||
}
|
||||
|
||||
// path replace
|
||||
if len(serverRoute.replacePath) > 0 {
|
||||
handler = &middlewares.ReplacePath{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue