Not able to access node server on heroku
-
18-10-2022 - |
Question
I have a very basic node.js based http server that I want to use as a proxy. I setup the hostname and port in my system wide proxy settings for all http requests to make sure all the http requests go to this server.
The problem is - When I run the server locally, using foreman start
and set localhost as hostname and 5000 as port, all my http requests are captured by this server. But when I deploy to Heroku, and using that host name and their port my page doesn't load.
Here is the code for the http server
var my_http = require("http");
var url = require('url');
var port = Number(process.env.PORT || 8080);
my_http.createServer(function(request, response) {
var url_parts = url.parse(request.url, true);
response.writeHeader(200, {
"Content-Type": "text/plain"
});
response.write(request.method + ": " + port + ': ' + url_parts.href);
response.end();
}).listen(port);
console.log("Server Running on " + port);
Note Foreman runs the application on port 5000 locally and runs on port 23536 on heroku.
My understanding of the problem We have a website traffic filter in the company that doesn't allow us to access most of the websites, directly. You need to click on a link (saying continue) every time you access a them. My understanding is that since I am trying to access those blocked websites, they are getting blocked or something (Though the request is proxied)?
No correct solution