Score:0

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

pg flag

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.

Jaromanda X avatar
ru flag
*502 Bad Gateway* implies a bad proxy config
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.