1.0.0 • Published 8 years ago

lastproxy v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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:
  example.com:
    /help: /current/working/page
    /about: /current/working/page2

proxy

Reverse proxy for specified host or path

proxy:
  # proxy for domain
  example.com: 127.0.0.1
  # proxy for specified path
  example.com
    /static: 127.0.0.1

localResponse

Map remote folder or file to local

localResponse:
  # localResponse exact url
  http://example.com/app.js: /local/path/to/debug.js
  # localResponse specified pattern
  example.com/static/**: /local/folder/to/static

interceptHttps

Intercept https for specified host

interceptHttps:
  www.example.com: true
  example2.com: true

cache

Disable cache by remove 'if-modified-since' and 'if-none-match' from request header

userAgent

allowOrigin

Add Access-Control-Allow-Origin header to response

See all configurable options

Usage

npm install
cp config.yml.sample config.yml

# You must have pm2 globally installed
# With pm2 your proxy will restart automatically after script or config files changed
npm start
# or start via nodemon
nodemon  --ext "js,yml" index.js
# or
node index.js