LastProxy
A wrapper provide yaml config for AnyProxy.
A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.
Features
Easily config the following options (features) for AnyProxy via yml config.
urlReplace
Redirect url to another path
urlReplace:
http://example.com/help: /current/working/page
http://example.com/about: http://example2.com/current/working/page2localResponse
Map remote file or folder to local
localResponse:
# localResponse for url or pattern
http://example.com/app.js: /local/path/to/debug.js
example.com/static/**: /local/folder/to/staticproxy
Reverse proxy for url or pattern
proxy:
# proxy for url or pattern
http://example.com/app.js: 127.0.0.1
example.com/static/**: 127.0.0.1weinre
Inject weinre script
weinre:
# inject weinre to all sites
# true
# or specified url
example.com/**: true
other.com/test/**: truepauseResponse
pause response in second
pauseResponse:
# pause response in second
# pauseResponse for url or pattern
example.com/images/**: 2interceptHttps
Intercept https for specified host
interceptHttps:
# intercept https for all sites
# true
# or sepcified host
www.example.com: true
example2.com: truecache
Disable cache by remove if-modified-since and if-none-match from request header
userAgent
Customize user-agent
allowOrigin
Add Access-Control-Allow-Origin header to response
See all configurable options
Installation
npm install -g lastproxyUsage
# start lastproxy, you can edit ~/.lastproxy.yml on your own.
lastproxyDevelopment
git clone https://github.com/yangg/lastproxy.git
cd lastproxy
npm install
cp config.yml.sample config.yml
# You must have pm2 globally installed
# With pm2 lastproxy will restart automatically after script or config files changed
npm start # alias for `pm2 start index.js --watch --name=last`
# or start via nodemon
# nodemon --ext "js,yml" index.js
# or
# node index.js