I am trying to write a proxy to access an api and have some working code that runs without problems on my local machine. Now I've tried to host this code on glitch.me and heroku, but it results in an ECONNREFUSED
error.
This only happens on the given domain, not on any other (e.g. www.google.com, www.nytimes.com, etc...). Running this code on localhost works fine.
I am having trouble understanding where the problem is located at and I haven't been very lucky finding much information about ECONNREFUSED
online.
This is the code that works on my machine, but doesn't on glitch.me or heroku:
const express = require('express');
const request = require('request');
const app = express();
const listener = app.listen(process.env.PORT, function () {
console.log('Your app is listening on port ' + listener.address().port);
});
app.get("/", function(req, res) {
request("https://api.justimmo.at/rest/v1/objekt/list", function (error, response, body) {
res.send(body);
});
});
This is what I get from the debugger:
error: { Error: connect ECONNREFUSED 88.99.236.189:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '88.99.236.189',
port: 443 }
The expected result would be a 401 Unauthorized
error.
Where is this problem possibly located at?