The following code works when deployed locally, receiving a request, and forwarding it to another server to validate a license:
var express = require("express");
var app = express();
var request = require("request");
var ddKey = "someKey";
var ddSecret = "someSecret";
var ProId = "someId";
var testLicense = "someLicense";
app.get("/", function(req, res){
var license = req.query["license"] || "test";
var url = "https://"+ddKey+":"+ddSecret+"@licenseServer.com/products/"+ProId+"/licenses/check_valid?key="+license;
request.get(url, {"auth": {"user": ddKey, "pass": ddSecret}, "json": true}, function(error, response, body){
res.send("BODY:", response.body);
});
});
var port = process.env.PORT || 3001;
app.listen(port, function(){
console.log("listening on port ", port);
});
When I deploy it on heroku however, and send a request to the heroku app I get a "no data received" screen along with this message:
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
When I check the heroku logs I see that heroku is indicating the following error:
Poorly formatted HTTP response
I am unable to locate what constitutes a correctly formatted response.
Thank you for any help you can provide.