Closed trusktr closed 6 months ago
Oh, we pass the options to Node http.createServer
directly I think.
Yep, that's it, using built-in https
instead of http
:
import https from 'https' // native Node https module
import httpProxy from 'http-proxy'
const proxy = httpProxy.createProxyServer({})
const server = https.createServer({
ca: [fs.readFileSync('/etc/letsencrypt/live/example.com/chain.pem')],
key: fs.readFileSync('/etc/letsencrypt/live/example.com/privkey.pem', 'utf8'),
cert: fs.readFileSync('/etc/letsencrypt/live/example.com/cert.pem', 'utf8'),
}, function(req, res) {
proxy.web(req, res, { target: newHost })
})
With
http-proxy
(last I used it years ago), there's an option like this:How do we do this with
proxy
?