1.0.24 • Published 8 years ago

browser-proxy v1.0.24

Weekly downloads
2
License
MIT
Repository
-
Last release
8 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

7 years ago

2.0.8

7 years ago

2.0.7

7 years ago

2.0.6

7 years ago

2.0.5

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.24

8 years ago

1.0.23

8 years ago

1.0.22

8 years ago

1.0.21

8 years ago

1.0.20

8 years ago

1.0.19

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago