How I can make an http(s) reverse proxy in nodejs?

Dimitrios Desyllas - Feb 20 '23 - - Dev Community

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
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player