Skip to content

Rewrite Middleware in Route #891

Closed Answered by ousloob
phhoef asked this question in Q&A
Discussion options

You must be logged in to vote

@phhoef
When you use mux.Route("/endpoint", func(r chi.Router) {...}), Chi creates a subrouter that is isolated from the parent router mux. When you attach middleware.RewriteRoute inside this subrouter, it only affects the routes defined inside that block and does not alter the URL before it reaches the subrouter.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by phhoef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants