Blank Page when Deploying HTMX served by Express/Node

Express serves my HTML/HTMX code when running localhost:3000. I upload the GitHub branch to a web service on Render, and it builds fine without issue.

In production, I’m telling express to use port 443. However, when navigating the, all I get is a blank page with this error in the console:

“Failed to load resource: the server responded with a status of 502 (Bad Gateway)”.

This works perfectly locally, so I’m trying to understand where my issue could lie. I come from a MERN stack background, so this is my first time trying to serve HTML/HTMX with an express server in a live environment.

After checking the Logs tab, I see this:

==> No open HTTP ports detected

Should I try editing my server.js file to use:

const app = express();
const port = 80;
const server = http.createServer(app):

Any help is appreciated.


Render Web Services expect an HTTP server to start on and a port (default 10000). TLS is handled upstream, so your server only needs to be setup to respond to HTTP calls (not HTTPS).

The port set on your server is only for communicating inside the Render network. Web Services are only accessible from the public internet on port 443 (HTTPS default).

More on this in the docs:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.