Node.js: Bad gateway on HTTPS server (unable to get the server's files?) – Server Fault

So, I have a Node.js server on It has only 2 files (server.js and index.html). But, when I load, the request for file index.html fails and throws 502 Bad Gateway. server.js contains this:

const http = require('http');
const ws = require('ws');
setInterval(()=>{}, 60000);
// Create an HTTP server
const httpSrv = new http.Server(function(req, res){ console.log('request:', req); }); httpSrv.keepAliveTimeout = 3600000; 
const server = new ws.Server({server: httpSrv}); server.keepAliveTimeout = 3600000; // do websocket things

It might be that I didn’t set the root directory of the server, but I think that should be the directory containing the script that initiated the server, right? Also, I specified nothing but a log in my request callback, so that might be the problem, but I guess the server should answer GET requests by sending the specified file automatically, right? I really have no idea where the problem is.

Read more here: Source link