Skip to content

Doesn't seem to recognize non proxy routes (express) #94

@newmanw

Description

@newmanw

Expected behavior

When setting up an express router, routes not in proxy context are not recognized. IE if filter function returns false, non proxy routes in sub application should be found.

Actual behavior

404 for routes in sub application

Setup

  • http-proxy-middleware: 0.17.0
  • server: express
  • other relevant modules

proxy middleware configuration

var filter = function (pathname, req) {
    return pathname.match(new RegExp('^/api'));
};
var apiProxy = proxy(filter, {target: 'http://www.example.org:8000'});

server mounting

var sub = new express.Router();
sub.use(proxy);

// main app, mount the sub application
var app = express();
app.use('/sub', sub);

other route in sub application

sub.get('/someroute',
   function(req, res, next) {
      // won't find route
   }
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions