'Setting http headers using nodejs

I am running nodejs on heroku. I want to set the following headers

RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
RequestHeader set X-Forwarded-SSL expr=%{HTTPS}

ProxyPass / http://localhost:8001/
ProxyPassReverse / http://localhost:8001/

How can I do so using the nodejs and express code?

I tried the following to set the x-forwarded-proto header

app.use(function(req, res, next) {
    res.setHeader("X-Forwarded-Proto", // something here);
    res.setHeader("X-Forwarded-SSL", // something here);

    next();
});

I'm j

but I can't seen to set the x-forwarded-ssl header like the example above



Solution 1:[1]

You need to do a

res.send(data)

at some point.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 N S Niko