Skip to content

Prefix can not handle variables (/path/:var/yy) #265

@ifavo

Description

@ifavo

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions