Prefix can not handle variables (/path/:var/yy)
ifavo opened this issue · 4 comments
ifavo commented
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.4.0
Plugin version
8.2.1
Node.js version
16
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
12.5
Description
When a route with a variable is configured
Then the target route is not correctly built
Steps to Reproduce
fastify.register(proxy, {
upstream: 'https://upstream',
prefix: '/path/:var/test',
rewritePrefix: '/proxied',
http2: true
})
Expected Behavior
The rewrite applies the following:
/path/123/test => /proxied
Instead it does:
/path/123/test => /path/123/test
It seems to have only a replace for the route definition (/path/:var/test
).
mcollina commented
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.
ifavo commented
@mcollina sure, I can try, do you know where fastify has the route-matching implemented?
mcollina commented
It's provided by https://github.com/delvedor/find-my-way