{"id":14989618,"url":"https://github.com/eugenecn/koa-server-http-proxy","last_synced_at":"2025-04-12T00:31:58.571Z","repository":{"id":143882879,"uuid":"143718832","full_name":"eugeneCN/koa-server-http-proxy","owner":"eugeneCN","description":"A koa-http-proxy-middleware","archived":false,"fork":false,"pushed_at":"2018-08-07T05:10:45.000Z","size":13,"stargazers_count":37,"open_issues_count":2,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-03-23T14:02:34.584Z","etag":null,"topics":["koa","koa-http-proxy","koa-http-proxy-middleware","koa-proxy"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eugeneCN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-08-06T11:26:28.000Z","updated_at":"2024-06-18T18:35:40.040Z","dependencies_parsed_at":null,"dependency_job_id":"b34ad263-e30d-4343-b771-4ae3691b2752","html_url":"https://github.com/eugeneCN/koa-server-http-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugeneCN%2Fkoa-server-http-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugeneCN%2Fkoa-server-http-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugeneCN%2Fkoa-server-http-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eugeneCN%2Fkoa-server-http-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eugeneCN","download_url":"https://codeload.github.com/eugeneCN/koa-server-http-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501407,"owners_count":21114673,"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":["koa","koa-http-proxy","koa-http-proxy-middleware","koa-proxy"],"created_at":"2024-09-24T14:18:39.462Z","updated_at":"2025-04-12T00:31:58.239Z","avatar_url":"https://github.com/eugeneCN.png","language":"JavaScript","readme":"\n# koa-server-http-proxy\n\nA koa2 http-proxy-middleware.\n\n## Installation\n\n```bash\n$ npm install koa-server-http-proxy --save\n```\n\n## Example\n\n```js\nconst Koa = require('koa')\n\nconst app = new Koa()\n\nconst proxy = require('koa-server-http-proxy')\n\napp.use(proxy('/api', {\n  target: 'https://news-at.zhihu.com',\n  pathRewrite: { '^/api': 'api/4/' },\n  changeOrigin: true\n}))\n\napp.listen(3000)\n\n\n```\n\n\n## Browser\n\n```\nhttp://127.0.0.1:3000/api/themes\n```\n\n\n## Example2\n\n```js\nconst Koa = require('koa')\n\nconst app = new Koa()\n\nconst proxy = require('koa-server-http-proxy')\n\nconst proxyTable = {\n  '/json': {\n    target: 'http://jsonplaceholder.typicode.com',\n    pathRewrite: { '^/json': '' },\n    changeOrigin: true\n  },\n  '/api': {\n    target: 'https://news-at.zhihu.com',\n    pathRewrite: { '^/api': 'api/4/' },\n    changeOrigin: true\n  }\n}\n\nObject.keys(proxyTable).forEach((context) =\u003e {\n  var options = proxyTable[context]\n  app.use(proxy(context, options))\n})\n\napp.listen(3000)\n\n\n```\n\n\n## Options\n\nAll options are passed to `http-proxy-middleware`, except that if options is passed\nas a string, it will normalized as options' target.\n\nSee [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware#options) for full list of\naccepted options.\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugenecn%2Fkoa-server-http-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feugenecn%2Fkoa-server-http-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feugenecn%2Fkoa-server-http-proxy/lists"}