Created
November 28, 2012 17:36
-
-
Save sadjow/4162756 to your computer and use it in GitHub Desktop.
Create a server with http-proxy node.js - Multiple domains.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I connect Apache server ?
Do you have documentation about source from this code ?