http-proxy

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2020 Jun 23 9:16
Editor
Edited
Edited
2023 Feb 10 5:1
Refs
Refs

function

const http = require('http') const httpProxy = require('http-proxy') const proxy = httpProxy.createProxyServer({}) http.createServer(function (req, res) { proxy.web(req, res, { target: 'http://localhost:3000' }) }).listen(3333) proxy.on('error', function (err, req, res) { if (err) console.log(err) res.writeHead(500) res.end('Ooops, something went very wrong...') })
 
websocket support
proxyServer.on('upgrade', function (req, socket, head) { proxy.ws(req, socket, head); });
 
 
 
 
 

Recommendations