eggjs/egg-development-proxyagent

Name: egg-development-proxyagent

Owner: egg

Description: A proxy adapter for debugging httpclient on egg.

Created: 2017-01-16 06:22:12.0

Updated: 2018-05-15 11:13:53.0

Pushed: 2017-07-14 08:40:15.0

Homepage: null

Size: 10

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

egg-development-proxyagent

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Nowadays lots of services are built upon HTTP protocol. So it's quite common to invoke backend services based on HTTP.

There is a built-in httpclient in Egg framework so that we can use it to invoke HTTP services easily.

This plugin provides a way of capturing HTTP request for debugging purpose.

Install
i egg-development-proxyagent --save-dev
s
onfig/plugin.local.js
rts.proxyagent = {
able: true,
ckage: 'egg-development-proxyagent',

Usage

This plugin will take effect only in local env. Because it overrides the agent and httpsAgent of httpclient, so it will work for every request. And also you can delegate HTTPS requests via HTTP.

http_proxy or HTTP_PROXY environment variable will be used if set in Bash. Or you can specify it when you start app:

tp_proxy=http://127.0.0.1:8888 node index.js
Capturing HTTPS Traffic

By default the http_proxy(or HTTP_PROXY) mentioned above will be passed to httpsAgent of urllib, and rejectUnauthorized = false will be set.

However, when using self-signed certificate we need to configure the certificate, shown as follows:

ca String | Buffer | Array - An array of strings or Buffers of trusted certificates. If this is omitted several well known “root” CAs will be used, like VeriSign. These are used to authorize connections. Notes: This is necessary only if the server uses the self-signed certificate

onfig/config.default.js
rts.proxyagent = {
: 'xxxxxxxxxxxx',

Capturing Tool

Note: Capturing tool is not in this plugin, you can use one of them below:

m install anyproxy -g
yproxy --port 8888
en http://localhost:8002

Screenshot:

anyproxy

Questions & Suggestions

Please open an issue here.

License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.