Skip to content

Allow custom matching in pathFilter option #25

@comfuture

Description

@comfuture

Greetings,

I am intending to utilize this module for conditional proxy purposes. In order to branch according to the expected accept: header in the request, I wrote a function in the pathFilter as follows:

pathFilter: (path, req) => accepts(req).types(['json', 'html']) === 'json'

Using custom matching in the pathFilter is well-explained in the http-proxy-middleware documentation:
https://github.com/chimurai/http-proxy-middleware#pathfilter-string-string-glob-glob-function

However, due to an attempt to serialize the options as JSON in the source code at https://github.com/wobsoriano/nuxt-proxy/blob/main/src/module.ts#L35, my approach does not function as anticipated. Is there a better way to preserve the original options during the process of generating virtual source code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions