• Ok, just fixed it, there was another problem too which required a more heavy workaround.

    Note that your code above will probably still break because you're not calling res.end all the time, but something like this works fine now:

    function startServer() {
      http.createServer(function (sreq, sres) {
        console.log('got http request',sreq.url);
        sres.writeHead(200);
        http.get("http://www.pur3.co.uk/hello.tx­t", function(res) {
          var data = '';
          console.log("Response");
          res.on('data', function(d) { data += d; });
          res.on('end', function() {
            console.log('get request ended');
            sres.end(data);
          });
        });
      }).listen(80);
      console.log('http server started');
    }
    

    (I pulled out all the ES6 stuff just in case that happened to be a potential issue, but I'm pretty sure it's not)

About

Avatar for Gordon @Gordon started