Responde#redirect doesnt consider "path" parameter passed in Application#use #1602

Closed
gimmi opened this Issue May 4, 2013 · 1 comment

Projects

None yet

2 participants

@gimmi
gimmi commented May 4, 2013

Hi, consider the following code:

var express = require('express');
var app = express();

app.use('/mountpath', app.router);

app.get('/resource', function (req, res) {
    res.redirect('otherresource');
});

app.listen(8080);

When i GET http://localhost:8080/mountpath/resource i expect to be redirected to http://localhost:8080/mountpath/otherresource, what i get instead is this:

$ curl http://localhost:8080/mountpath/resource
Moved Temporarily. Redirecting to /otherresource
@tj
Member
tj commented May 11, 2013

try use('/mountpath', app) not app.router

@tj tj closed this May 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment