{"id":13605349,"url":"https://github.com/zjpzjp/vite-plugin-debug-proxy","last_synced_at":"2025-04-12T05:32:36.623Z","repository":{"id":195960755,"uuid":"694053650","full_name":"zjpzjp/vite-plugin-debug-proxy","owner":"zjpzjp","description":"dynamic proxy http/https","archived":false,"fork":false,"pushed_at":"2024-03-29T06:32:46.000Z","size":11,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T21:49:41.435Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zjpzjp.png","metadata":{"files":{"readme":"readme-zh.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}},"created_at":"2023-09-20T08:35:33.000Z","updated_at":"2025-02-13T02:38:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc2050d8-2e31-47ce-b1fe-6058da4718b5","html_url":"https://github.com/zjpzjp/vite-plugin-debug-proxy","commit_stats":null,"previous_names":["zjpzjp/vite-plugin-debug-proxy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjpzjp%2Fvite-plugin-debug-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjpzjp%2Fvite-plugin-debug-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjpzjp%2Fvite-plugin-debug-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zjpzjp%2Fvite-plugin-debug-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zjpzjp","download_url":"https://codeload.github.com/zjpzjp/vite-plugin-debug-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248524181,"owners_count":21118609,"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":[],"created_at":"2024-08-01T19:00:57.673Z","updated_at":"2025-04-12T05:32:36.372Z","avatar_url":"https://github.com/zjpzjp.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Framework-agnostic Plugins"],"readme":"当在开发阶段使用Vite构建前端应用时，有时需要与多个后端服务器进行交互。\n\u003e 例如：mock环境、测试环境、生产环境\n\n为了简化这一过程，我创建了一个名为\"Vite动态反向代理插件\"的工具。\n这个插件可以根据URL上的参数（?debug=URL）动态设置反向代理，\n能够轻松地在不同的开发和测试环境中切换，而无需手动更改代理设置。\n\n### 功能特点\n\n- **动态代理配置**：根据URL上的参数自动配置反向代理，无需手动更改Vite配置文件。\n- **简单易用**：只需安装插件并提供所需的参数，即可轻松集成到您的Vite项目中。\n- **灵活性**：支持在开发阶段灵活切换代理目标，以适应不同的测试环境。\n\n### 如何使用\n\n1. 安装插件：\n\n   ```shell\n   npm install vite-plugin-debug-proxy\n   ```\n\n2. 在Vite配置文件中使用插件：\n\n   ```javascript\n   // vite.config.js\n   import dynamicProxy from 'vite-plugin-debug-proxy';\n\n   export default {\n     // ...其他配置\n\n     plugins: [\n       // ...\n       dynamicProxy({\n           path:new RegExp(\"^/api\")//使用正则\n         //path:\"/api\" //使用字符串路径\n       }),\n     ],\n   };\n   ```\n\n\n3. 访问您的应用程序时，可以通过URL参数自动设置代理目标，例如：\n\n   -  ` 例如：http://localhost:3000?debug=https://192.168.1.123:8080/`\n   表示将所有http://localhost:3000/api/* 代理到 https://192.168.1.123:8080/*   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjpzjp%2Fvite-plugin-debug-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzjpzjp%2Fvite-plugin-debug-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzjpzjp%2Fvite-plugin-debug-proxy/lists"}