Skip to content

Instantly share code, notes, and snippets.

@tylor
Created December 7, 2012 20:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tylor/4236269 to your computer and use it in GitHub Desktop.
Save tylor/4236269 to your computer and use it in GitHub Desktop.
Quick node.js HTTP proxy on Heroku

Spin up a quick proxy on Heroku. Make sure you have heroku and git on your computer:

  1. Download these files into a directory
  2. Change 'some-target.com' to your target domain index.js
  3. $ git init
  4. $ git add .
  5. $ git commit -m "And away we go..."
  6. $ heroku create
  7. $ git push heroku master
  8. $ heroku ps:scale web=1
  9. $ heroku open

If you have trouble with Heroku, consult their node.js getting started guide.

var httpProxy = require('http-proxy');
httpProxy.createServer(80, 'some-target.com').listen(process.env.PORT || 8000);
{
"name": "proxy",
"version": "0.0.0",
"description": "Proxy something",
"main": "index.js",
"repository": "",
"author": "",
"license": "BSD",
"dependencies": {
"http-proxy": "~0.8.5"
},
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
}
}
web: node index.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment