fastify-http-proxy
fastify-http-proxy copied to clipboard
Prefix can not handle variables (/path/:var/yy)
Prerequisites
- [X] I have written a descriptive issue title
- [X] 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
).
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.
@mcollina sure, I can try, do you know where fastify has the route-matching implemented?
It's provided by https://github.com/delvedor/find-my-way
@mcollina I have added this pull request https://github.com/fastify/fastify-http-proxy/pull/266
I had a little trouble finding my way thru the tests, hopefully it is okay?