I managed to make a proxy server in nodeJS that works for http requests (code below), but I want it to work with HTTPS web servers. I have a self-signed certificate. Is there any way I can modify this code to work with HTTPS web server?
const http = require('http');
const httpProxy = require('http-proxy');
const url = require('url');
const proxy = httpProxy.createProxyServer({});
http.createServer((req, res) => {
console.log('Original URL:', req.url);
// Proxy the modified request to the target URL
proxy.web(req, res, {
target: "http://localhost:8000/hehelol",
headers: req.headers,
});
}).listen(3000);
console.log('Proxy server listening on port 3000');