{"id":13685491,"url":"https://github.com/eggjs/egg-development-proxyagent","last_synced_at":"2025-05-01T04:31:09.718Z","repository":{"id":57220381,"uuid":"79088946","full_name":"eggjs/egg-development-proxyagent","owner":"eggjs","description":"[DEPRECATED] A proxy adapter for debugging httpclient on egg.","archived":true,"fork":false,"pushed_at":"2019-03-26T03:51:17.000Z","size":10,"stargazers_count":21,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T04:34:27.211Z","etag":null,"topics":["egg-development","egg-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-16T06:22:12.000Z","updated_at":"2023-11-13T09:09:18.000Z","dependencies_parsed_at":"2022-08-28T23:23:16.789Z","dependency_job_id":null,"html_url":"https://github.com/eggjs/egg-development-proxyagent","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-development-proxyagent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-development-proxyagent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-development-proxyagent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Fegg-development-proxyagent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/egg-development-proxyagent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251128669,"owners_count":21540495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["egg-development","egg-plugin"],"created_at":"2024-08-02T14:00:52.456Z","updated_at":"2025-05-01T04:31:09.696Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","readme":"# egg-development-proxyagent\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-development-proxyagent.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-development-proxyagent\n[travis-image]: https://img.shields.io/travis/eggjs/egg-development-proxyagent.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-development-proxyagent\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-development-proxyagent.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/egg-development-proxyagent?branch=master\n[david-image]: https://img.shields.io/david/eggjs/egg-development-proxyagent.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/egg-development-proxyagent\n[snyk-image]: https://snyk.io/test/npm/egg-development-proxyagent/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-development-proxyagent\n[download-image]: https://img.shields.io/npm/dm/egg-development-proxyagent.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-development-proxyagent\n\nNowadays lots of services are built upon HTTP protocol. So it's quite common to invoke backend services based on HTTP.\n\nThere is a built-in [httpclient](https://eggjs.org/zh-cn/core/httpclient) in Egg framework so that we can use it to invoke HTTP services easily.\n\nThis plugin provides a way of capturing HTTP request for debugging purpose.\n\n## DEPRECATED\n\n**This plugin is deprecated, instead, you just need to add below code to `config.local.js`**\n\n```js\n// config.local.js\nmodule.exports = () =\u003e {\n  const config = {};\n\n  // add http_proxy to httpclient\n  if (process.env.http_proxy) {\n    config.httpclient = {\n      request: {\n        enableProxy: true,\n        rejectUnauthorized: false,\n        // proxy: process.env.http_proxy,\n      },\n    };\n  }\n\n  return config;\n}\n```\n\nthen start your application by:\n\n```bash\n$ http_proxy=http://127.0.0.1:8888 npm run dev\n```\n\n## Install\n\n```bash\nnpm i egg-development-proxyagent --save-dev\n```\n\n```js\n// config/plugin.local.js\nexports.proxyagent = {\n  enable: true,\n  package: 'egg-development-proxyagent',\n};\n```\n\n## Usage\n\nThis 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.\n\n`http_proxy` or `HTTP_PROXY` environment variable will be used if set in Bash. Or you can specify it when you start app:\n\n```bash\n$ http_proxy=http://127.0.0.1:8888 node index.js\n```\n\n### Capturing HTTPS Traffic\n\nBy default the `http_proxy`(or `HTTP_PROXY`) mentioned above will be passed to `httpsAgent` of urllib, and `rejectUnauthorized = false` will be set.\n\nHowever, when using self-signed certificate we need to configure the certificate, shown as follows:\n\n\u003e `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\n\n```js\n// config/config.default.js\nexports.proxyagent = {\n  ca: 'xxxxxxxxxxxx',\n};\n```\n\n### Capturing Tool\n\n**Note: Capturing tool is not in this plugin**, you can use one of them below:\n\n- [charles](https://www.charlesproxy.com/)\n- [fiddler](http://www.telerik.com/fiddler)\n- [anyproxy](https://github.com/alibaba/anyproxy) is a capturing tool writtern in node. It provides a web console, it's a good replacement of charles.\n\n```bash\n$ npm install anyproxy -g\n$ anyproxy --port 8888\n$ open http://localhost:8002\n```\n\nScreenshot:\n\n![anyproxy](https://cloud.githubusercontent.com/assets/227713/21976937/06a63694-dc0f-11e6-98b5-e9e279c4867c.png)\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-development-proxyagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Fegg-development-proxyagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Fegg-development-proxyagent/lists"}