A simple how to is located in my stackoverflow question:
I am developing an http "middleman" (aka reverse proxy) using nodejs. So far I made a basic server listening to http and https:
const http = require('node:http')
let https = require('node:https');
const app = (req,res)=>{
// Forward the request to respecitve http
};
http.createServer(app).listen(80);
https.createServer({
// typical https options ommited
…