Skip to content

Instantly share code, notes, and snippets.

@fohlin
Created October 26, 2018 08:24
Show Gist options
  • Save fohlin/8a50e72f6554c115ebae32c4f4732899 to your computer and use it in GitHub Desktop.
Save fohlin/8a50e72f6554c115ebae32c4f4732899 to your computer and use it in GitHub Desktop.
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({target:'http://localhost:3000'});
proxy.on('proxyReq', function(proxyReq, req, res, options) {
console.info(req);
res.setHeader('X-Special-Proxy-Header', 'foobar');
proxyReq.setHeader('X-Special-Proxy-Header', 'foobar');
});
proxy.listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment