I am trying to create an internet facing server for an internal node express server, which is a Windows For this purpose, a Virtual Unix box has been opened with the port, and I am using http-proxy to create a proxy server that redirects the request to my internal server
< P> If the internal server is down then I I want to show a custom HTML page to users. I have the code running in the Virtual Unix box (the relevant part): var proxy = httpProxy.createProxyServer ({target: 'http: // '+ Addr.to [2] +': '+ Addr.to [3], xfwd: true, ws: true}); ProxyLitien (from ADR [3], from ADR [2]); Winston.info ('- Proxy server started listening:' + addr.from [2] + ':' + addr.from [3]); Proxy.on ('error', function (err, req, res) {console.log (err)) {winston.error ('Middleware Server Down, Delivering 404 Page'); Res.writeHead (500, {content (type ':' text / html '}); fs.readFile (__DERNAM +' / 404.html ', function (mistake, html) {if (err) {fail err ;} Res.write (html); res.end ();});} cache (er) {winston.error ('error:' + er);}});
The above code works fine if I run it in windows machines for some reason, when I run in Unix box it does not work Does anyone help me understand this Why does this happen? It would be great if you can provide alternate means to find out when the target server is down in the HTTP-proxy.
Let me know if you need any additional information.
Comments
Post a Comment