I\'m trying to build a proxy server on with Node.js on Heroku using http-proxy. Everything works fine locally, but I\'m having some troubles on Heroku.
var
I finally made it work using a slightly modified version proxy-by-url. The final code looks something like this and works fine.
var httpProxy = require('http-proxy');
var port = process.env.PORT || 8000;
var routing = {
'/devices': { port: process.env.DEVICES_PORT || 80, host: process.env.DEVICES_URI }
}
var server = httpProxy.createServer(
require('./lib/uri-middleware')(routing)
).listen(port);
One note to remember. The plugin sets the header HOST to the destination application uri. If you do not do so, Heroku will not recognize the app and will not find it, as its internal routing system seems to be based on the HOST header.
I use http-proxy successfully on Heroku. The first thing I noticed in your log err is the url it is GETting: GET lelylan-api.herokuapp.com/tdevices
There is a typo... instead of '/devices' it shows '/tdevices'. Before continuing can you confirm this is the actual log message?