{"id":14989381,"url":"https://github.com/vagusx/koa-proxies","last_synced_at":"2025-10-24T17:17:18.612Z","repository":{"id":38403969,"uuid":"76923689","full_name":"vagusX/koa-proxies","owner":"vagusX","description":"a koa@2.x+ proxy middleware","archived":false,"fork":false,"pushed_at":"2025-07-29T09:18:12.000Z","size":83,"stargazers_count":163,"open_issues_count":13,"forks_count":45,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-22T09:02:49.472Z","etag":null,"topics":["koa","koa-middleware","koa-proxies","koa2","node-http-proxy","proxy"],"latest_commit_sha":null,"homepage":"https://vagusx.github.io/koa-proxies/","language":"JavaScript","has_issues":true,"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/vagusX.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-20T04:42:50.000Z","updated_at":"2025-06-10T15:04:34.000Z","dependencies_parsed_at":"2024-06-18T12:40:24.610Z","dependency_job_id":"0be97508-6936-4732-a089-9e1038fe5ee0","html_url":"https://github.com/vagusX/koa-proxies","commit_stats":{"total_commits":73,"total_committers":16,"mean_commits":4.5625,"dds":0.4383561643835616,"last_synced_commit":"5653d31da2f4116b847e074d46e055f8b09d53b2"},"previous_names":[],"tags_count":21,"template":true,"template_full_name":null,"purl":"pkg:github/vagusX/koa-proxies","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vagusX%2Fkoa-proxies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vagusX%2Fkoa-proxies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vagusX%2Fkoa-proxies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vagusX%2Fkoa-proxies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vagusX","download_url":"https://codeload.github.com/vagusX/koa-proxies/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vagusX%2Fkoa-proxies/sbom","scorecard":{"id":914616,"data":{"date":"2025-08-11","repo":{"name":"github.com/vagusX/koa-proxies","commit":"5653d31da2f4116b847e074d46e055f8b09d53b2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Code-Review","score":3,"reason":"Found 8/26 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/vagusX/koa-proxies/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/vagusX/koa-proxies/node.js.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:29","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-24T20:31:34.744Z","repository_id":38403969,"created_at":"2025-08-24T20:31:34.744Z","updated_at":"2025-08-24T20:31:34.744Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280833459,"owners_count":26399074,"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","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["koa","koa-middleware","koa-proxies","koa2","node-http-proxy","proxy"],"created_at":"2024-09-24T14:18:16.578Z","updated_at":"2025-10-24T17:17:18.574Z","avatar_url":"https://github.com/vagusX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Koa Proxies\n\n![NPM](https://img.shields.io/npm/v/koa-proxies.svg)\n\n[![Node.js CI](https://github.com/vagusX/koa-proxies/actions/workflows/node.js.yml/badge.svg)](https://github.com/vagusX/koa-proxies/actions/workflows/node.js.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/vagusX/koa-proxies.svg)](https://codecov.io/gh/vagusX/koa-proxies)\n[![NPM Downloads](https://img.shields.io/npm/dm/koa-proxies.svg)](https://www.npmjs.com/package/koa-proxies)\n[![Greenkeeper badge](https://badges.greenkeeper.io/vagusX/koa-proxies.svg)](https://greenkeeper.io/)\n\n\u003e [Koa@2.x/next](https://github.com/koajs/koa) middlware for http proxy\n\nPowered by [`http-proxy`](https://github.com/nodejitsu/node-http-proxy).\n\n## Installation\n\n```bash\n$ npm install koa-proxies --save\n```\n\n## Options\n\n### http-proxy events\n\n```js\noptions.events = {\n  error (err, req, res) { },\n  proxyReq (proxyReq, req, res) { },\n  proxyRes (proxyRes, req, res) { }\n}\n```\n\n### log option\n```js\n// enable log\noptions.logs = true; // or false\n\n// custom log function\noptions.logs = (ctx, target) {\n  console.log('%s - %s %s proxy to -\u003e %s', new Date().toISOString(), ctx.req.method, ctx.req.oldPath, new URL(ctx.req.url, target))\n}\n```\n\n## Usage\n\n```js\n// dependencies\nconst Koa = require('koa')\nconst proxy = require('koa-proxies')\nconst httpsProxyAgent = require('https-proxy-agent')\n\nconst app = new Koa()\n\n// middleware\napp.use(proxy('/octocat', {\n  target: 'https://api.github.com/users/',\n  changeOrigin: true,\n  agent: new httpsProxyAgent('http://1.2.3.4:88'), // if you need or just delete this line\n  rewrite: path =\u003e path.replace(/^\\/octocat(\\/|\\/\\w+)?$/, '/vagusx'),\n  logs: true\n}))\n```\nThe 2nd parameter `options` can be a function. It will be called with the path matching result (see [path-match](https://www.npmjs.com/package/path-match) for details) and Koa `ctx` object. You can leverage this feature to dynamically set proxy. Here is an example:\n\n```js\n// dependencies\nconst Koa = require('koa')\nconst proxy = require('koa-proxies')\n\nconst app = new Koa()\n\n// middleware\napp.use(proxy('/octocat/:name', (params, ctx) =\u003e {\n  return {\n    target: 'https://api.github.com/',\n    changeOrigin: true,\n    rewrite: () =\u003e `/users/${params.name}`,\n    logs: true\n  }})\n)\n```\nMoreover, if the `options` function return `false`, then the proxy will be bypassed. This allows the middleware to bail out even if path matching succeeds, which could be helpful if you need complex logic to determine whether to proxy or not.\n\n\n### Attention\n\nPlease make sure that `koa-proxies` is in front of `koa-bodyparser` to avoid this [issue 55](https://github.com/vagusX/koa-proxies/issues/55)\n\n```js\nconst Koa = require('koa')\nconst app = new Koa()\nconst proxy = require('koa-proxies')\nconst bodyParser = require('koa-bodyparser')\n\napp.use(proxy('/user', {\n  target: 'http://example.com',\n  changeOrigin: true\n}))\n\napp.use(bodyParser())\n```\n\n[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvagusx%2Fkoa-proxies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvagusx%2Fkoa-proxies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvagusx%2Fkoa-proxies/lists"}