Created
November 13, 2013 20:21
-
-
Save tastywheat/7455693 to your computer and use it in GitHub Desktop.
nodejs reverse proxy
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 httpProxy = require('http-proxy'); | |
var options = { | |
pathnameOnly: true, | |
// this list is processed from top to bottom, so '.*' will go to | |
// '127.0.0.1:3000' if the Host header hasn't previously matched | |
router : { | |
'/api': '127.0.0.1:4271', | |
//'': '127.0.0.1:3002', | |
//'^.*\.sample\.com': '127.0.0.1:3002', | |
'': '127.0.0.1:3000' | |
} | |
}; | |
// bind to port 80 on the specified IP address | |
// Note: need to run this as root because port 80 | |
httpProxy.createServer(options).listen(80); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment