Closed
Description
Issue Description
I want to use the rewrite middleware because my url schema has changed. Using this middleware will not forward requests to the handler functions.
Checklist
- [x ] Dependencies installed
- [ x] No typos
- [ x] Searched existing issues and docs
Expected behaviour
I expect this middleware to rewrite the url and forward the request to the appropriate handler.
Actual behaviour
Middleware does not call next(c) and thus it stops the chain.
Steps to reproduce
- start an echo server with rewrite middleware
- do a request
- service returns a 200 - OK regardless the request url
Working code to debug
func main() {
e := echo.New()
e.Use(middleware.RewriteWithConfig(middleware.RewriteConfig{
Rules: map[string]string{
"/old": "/new",
"/api/*": "/$1",
"/js/*": "/public/javascripts/$1",
"/users/*/orders/*": "/user/$1/order/$2",
},
}))
e.GET("/users", func(c echo.Context) error {
return c.String(200, "Yeah")
})
e.Logger.Fatal(e.Start(":8080"))
}
and now a curl :
curl http://localhost:8080/api/users -i