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

Modify path before redirect #138

Open
diginfo opened this issue Jan 20, 2018 · 1 comment
Open

Modify path before redirect #138

diginfo opened this issue Jan 20, 2018 · 1 comment

Comments

@diginfo
Copy link

diginfo commented Jan 20, 2018

Based on the example provided in the readme, it seems that req is not being sent to the resolver as I always get an undefined when I log it to the console.

I am trying to remove the '/server' from the path and forward to the root of the proxied server but are unable to do so.

Is there another way as this is a showstopper for me :-(

 var proxy = new require('redbird')({
    port: 81,
    resolvers: [
    function(host, url, req) {
      console.log(host,url,req);
      if(/server1/.test(url)){
        req.url = '/';
        url = '/';
        return 'http://192.168.0.154/'
      }
    }]
 })

UPDATE

I have tried returning an object but that does not work, the original path is still sent to the forwarded server:

return ({url:'http://192.168.0.154',path:'/',opts:{}});

Also, in the readme it says "Do headers based routing." but I cannot see any way of doing this if the request is not sent to the resolver ??

@pcnate
Copy link

pcnate commented Sep 13, 2022

created issue #281

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

2 participants