Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite middleware does not work on latest commit #1086

Closed
rvdwijngaard opened this Issue Mar 15, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@rvdwijngaard
Copy link

rvdwijngaard commented Mar 15, 2018

/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/ / / / / / / / / / / / / / / / / /

Please use forum https://forum.labstack.com to ask questions!

/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/ / / / / / / / / / / / / / / / / /

Issue Description

Checklist

  • Dependencies installed
  • No typos
  • Searched existing issues and docs

Expected behaviour

rewrite middleware should rewrite the url as configured

Actual behaviour

it returns a 404

Steps to reproduce

  • get the latest version of echo (at least commit 7f44549)

Working code to debug

package main

import (
	"github.com/labstack/echo"
	"github.com/labstack/echo/middleware"
)

func main() {
	e := echo.New()
	e.Pre(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 than a curl :

curl localhost:8080/api/users

this returns a 404

When running this program with commit f4dde46 it works as expected.

Version/commit

7f44549

JReuling pushed a commit to JReuling/echo that referenced this issue Mar 16, 2018

JReuling pushed a commit to JReuling/echo that referenced this issue Mar 16, 2018

JReuling pushed a commit to JReuling/echo that referenced this issue Mar 16, 2018

JReuling pushed a commit to JReuling/echo that referenced this issue Mar 16, 2018

vishr added a commit that referenced this issue Mar 16, 2018

@vishr vishr closed this in a5d81b8 Mar 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.