Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a async router function? #382

Closed
dzz9143 opened this issue Dec 24, 2019 · 3 comments
Closed

Is there a async router function? #382

dzz9143 opened this issue Dec 24, 2019 · 3 comments

Comments

@dzz9143
Copy link

dzz9143 commented Dec 24, 2019

Question

I want to dynamically change target for proxy, router options as a function seems to be a good choice, but it's a sync function returns a target string.

Is there a way to do the async router function, something like this

async function asyncRouterFunc(req) {
    const target = await getNewTargetBasedOnReq(req);
    return target;
}
@chimurai
Copy link
Owner

Just merged this in PR #379

I released a beta version:
npm install http-proxy-middleware@0.21.0-beta.1

Let me know if you run into issues.

@hjagodzinski
Copy link

@chimurai it works like a charm. Thanks!

@chimurai
Copy link
Owner

published: http-proxy-middleware@0.21.0 with async router support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants