Skip to content

Instantly share code, notes, and snippets.

@sadjow
Created November 28, 2012 17:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sadjow/4162756 to your computer and use it in GitHub Desktop.
Save sadjow/4162756 to your computer and use it in GitHub Desktop.
Create a server with http-proxy node.js - Multiple domains.
var http = require('http'),
httpProxy = require('http-proxy');
httpProxy.createServer(function (req, res, proxy) {
if(req.headers.host == 'sadjow.com') {
proxy.proxyRequest(req, res, {
host: 'sadjow.com',
port: 3000
});
} else {
res.end('Site em manutenção.');
}
}).listen(80);
@denizkarakass
Copy link

How can I connect Apache server ?
Do you have documentation about source from this code ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment