0

So, I have a Node.js server on render.com. It has only 2 files (server.js and index.html). But, when I load myservername.onrender.com/index.html, 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; 
httpSrv.listen(443);
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.

1
  • 1
    502 Bad Gateway implies a bad proxy config May 23 at 6:30

0

You must log in to answer this question.

Browse other questions tagged .