├── README.md ├── index.js ├── package.json └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | # simple-http-proxy -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var http = require('http'); 2 | var httpProxy = require('http-proxy'); 3 | // const publicIp = require('public-ip'); 4 | const proxy = httpProxy.createProxyServer({}); 5 | const port = process.env.PORT || 8000; 6 | http.createServer(function(req, res) { 7 | console.log(req.url); 8 | proxy.web(req, res, { target: req.url }); 9 | }).listen(port, () => { 10 | console.log('listening on port', port); 11 | }); 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple-http-proxy", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index", 8 | "list": "forever list" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/timathon/simple-http-proxy.git" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "bugs": { 18 | "url": "https://github.com/timathon/simple-http-proxy/issues" 19 | }, 20 | "homepage": "https://github.com/timathon/simple-http-proxy#readme", 21 | "dependencies": { 22 | "forever": "^1.0.0", 23 | "http-proxy": "^1.17.0", 24 | "public-ip": "^3.1.0" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | --------------------------------------------------------------------------------