1.0.24 • Published 9 years ago

browser-proxy v1.0.24

Weekly downloads
2
License
MIT
Repository
-
Last release
9 years ago

browser-proxy

UI界面

Alt text

前端调试的代理调试工具

  • 代理到本地文件
  • 支持host设置(支持单个请求host)
  • 代理到url
  • 文件合并
  • 修改配置立即生效
  • 基于nodejs,支持windows, mac, linux
  • 添加response headers

install and start app

sudo npm install browser-proxy -g

// start browser proxy with default port
browser-proxy

// set port & start browser-proxy
browser-proxy -p 8888

// use local config
mkdir -p /Users/zoborzhang/config/
cd /Users/zoborzhang/config/
touch config.js
edit config.js with follow code:

  module.exports = {
    rules: [
      // map to localfile
      {
        regx: '^https?://v.qq.com/welcome.html',
        localFile: './welcome.html',
      }
    ],
    disable_cache: true,
    disable_gzip: true
  }
now start: browser-proxy

启动UI界面,浏览器打开

http://localhost:9000

代理规则

代理规则参考config.js

>> 代理请求到本地文件

{
	regx: '^https?://v.qq.com/welcome.html',
	'localFile': '/path/to/local/index.html'
}

>> 代理请求到本地目录

{
  'regx': 'http://imgcache.qq.com/tencentvideo_v1/tvp/js/([^?]+)',
  'localPath': '/path/to/local/'
}

>> 代理文请求添加responseHeaders

{
  'regxPath': 'http://imgcache.qq.com/tencentvideo_v1/tvp/js/([^?]+)',
  'localPath': '/path/to/local/',
	'responseHeaders': {
		'Access-Control-Allow-Origin':'http://v.qq.com',
		'Access-Control-Allow-Credentials': 'true'
	}
}

>> cdn合并请求代理

{
  'regx': 'http://vm.gtimg.cn/c/=/tencentvideo/txp/js/([^?]+)',
  'comboMaps': {
    '/tencentvideo/txp/js/': '/path/to/local/',
  }
}

>> 支持cgi jsonp

{
  'indexof': 'http://vm.gtimg.cn/tencentvideo/txp/js/txplayer.json',
  'jsonp': '/path/to/local/txplayer.json'
}

>> 指定返回http status code

{
  'regx': 'http://vm.gtimg.cn/tencentvideo/txp/js/txplayer.js',
  'httpStatus': '404'
}

>> 单个请求指定hosts

{
  'regx': 'http://vm.gtimg.cn/tencentvideo/txp/js/txplayer.js',
  'host': '127.0.0.1'
}

安装证书:

On MacOS

cd /usr/local/lib/node_modules/browser-proxy/ sh install_certificate.sh

On Android or IOS

visit http://ip:9000/install

On Windows

visit http://ip:9000/install and download certificate double click to install

2.0.9

9 years ago

2.0.8

9 years ago

2.0.7

9 years ago

2.0.6

9 years ago

2.0.5

9 years ago

2.0.4

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.0.24

9 years ago

1.0.23

9 years ago

1.0.22

9 years ago

1.0.21

9 years ago

1.0.20

9 years ago

1.0.19

9 years ago

1.0.17

9 years ago

1.0.16

9 years ago

1.0.15

9 years ago

1.0.14

10 years ago

1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago