├── .autod.conf.js ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .github ├── FUNDING.yml └── workflows │ ├── build.yml │ ├── codacy-analysis.yml │ ├── codeql-analysis.yml │ ├── nodejs.yml │ ├── publish-test.yml │ └── publish.yml ├── .gitignore ├── .markdownlint.json ├── .prettierignore ├── .prettierrc.js ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── app.js ├── app └── middleware │ └── httpProxyPlus.js ├── appveyor.yml ├── config └── config.default.js ├── package.json ├── pnpm-lock.yaml ├── scripts ├── publish.ts ├── sync.ts ├── unpublish.ts └── workflow.mjs ├── sonar-project.properties └── test ├── fixtures └── apps │ └── http-proxy-test │ ├── app │ ├── controller │ │ └── home.js │ └── router.js │ ├── config │ ├── config.default.js │ └── plugin.js │ ├── logs │ └── http-proxy-test │ │ ├── common-error.log │ │ ├── egg-agent.log │ │ ├── egg-schedule.log │ │ ├── egg-web.log │ │ └── http-proxy-test-web.log │ ├── package.json │ └── run │ ├── agent_config.json │ ├── agent_config_meta.json │ ├── agent_timing_84615.json │ ├── agent_timing_88366.json │ ├── application_config.json │ ├── application_config_meta.json │ ├── application_timing_84615.json │ ├── application_timing_88366.json │ └── router.json └── http-proxy.test.js /.autod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | module.exports = { 4 | write: true, 5 | prefix: '^', 6 | plugin: 'autod-egg', 7 | test: ['test', 'benchmark'], 8 | devdep: [ 9 | 'egg', 10 | 'egg-ci', 11 | 'egg-bin', 12 | 'egg-path-matching', 13 | 'autod', 14 | 'autod-egg', 15 | 'eslint', 16 | 'eslint-config-egg', 17 | 'http-proxy-middleware', 18 | 'koa2-connect', 19 | 'lodash', 20 | 'webstorm-disable-index' 21 | ], 22 | exclude: ['./test/fixtures', './docs', './coverage'] 23 | } 24 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | 7 | [*.{js,jsx,ts,tsx,vue,html}] 8 | root = true 9 | indent_style = tab 10 | indent_size = 4 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [*.{yml}] 15 | indent_style = space 16 | indent_size = 2 -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | .git 2 | node_modules 3 | /run 4 | dist 5 | public 6 | 7 | *.bak 8 | *_bak 9 | *.bak.js 10 | 11 | stats.html 12 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['eslint-config-egg', '@eslint-sets/basic'], 3 | rules: { 4 | camelcase: 0, 5 | 'no-only-tests/no-only-tests': 0 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [saqqdy] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | types: [opened, synchronize, reopened] 8 | jobs: 9 | sonarcloud: 10 | name: SonarCloud 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | with: 15 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis 16 | - name: SonarCloud Scan 17 | uses: SonarSource/sonarcloud-github-action@master 18 | env: 19 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any 20 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 21 | -------------------------------------------------------------------------------- /.github/workflows/codacy-analysis.yml: -------------------------------------------------------------------------------- 1 | # This workflow checks out code, performs a Codacy security scan 2 | # and integrates the results with the 3 | # GitHub Advanced Security code scanning feature. For more information on 4 | # the Codacy security scan action usage and parameters, see 5 | # https://github.com/codacy/codacy-analysis-cli-action. 6 | # For more information on Codacy Analysis CLI in general, see 7 | # https://github.com/codacy/codacy-analysis-cli. 8 | 9 | name: Codacy Security Scan 10 | 11 | on: 12 | push: 13 | branches: [master] 14 | pull_request: 15 | # The branches below must be a subset of the branches above 16 | branches: [master] 17 | schedule: 18 | - cron: '16 21 * * 1' 19 | 20 | jobs: 21 | codacy-security-scan: 22 | name: Codacy Security Scan 23 | runs-on: ubuntu-latest 24 | steps: 25 | # Checkout the repository to the GitHub Actions runner 26 | - name: Checkout code 27 | uses: actions/checkout@v2 28 | 29 | # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis 30 | - name: Run Codacy Analysis CLI 31 | uses: codacy/codacy-analysis-cli-action@1.1.0 32 | with: 33 | # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository 34 | # You can also omit the token and run the tools that support default configurations 35 | project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} 36 | verbose: true 37 | output: results.sarif 38 | format: sarif 39 | # Adjust severity of non-security issues 40 | gh-code-scanning-compat: true 41 | # Force 0 exit code to allow SARIF file generation 42 | # This will handover control about PR rejection to the GitHub side 43 | max-allowed-issues: 2147483647 44 | 45 | # Upload the SARIF file generated in the previous step 46 | - name: Upload SARIF results file 47 | uses: github/codeql-action/upload-sarif@v2 48 | with: 49 | sarif_file: results.sarif 50 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: CodeQL 13 | 14 | on: 15 | push: 16 | branches: [master] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [master] 20 | schedule: 21 | - cron: '20 22 * * 4' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [javascript] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v2 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v2 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v2 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | # - run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v2 72 | -------------------------------------------------------------------------------- /.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Node.js CI 5 | 6 | on: 7 | push: 8 | branches: 9 | - main 10 | - master 11 | pull_request: 12 | branches: 13 | - main 14 | - master 15 | schedule: 16 | - cron: '0 2 * * *' 17 | 18 | jobs: 19 | build: 20 | runs-on: ${{ matrix.os }} 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | node-version: [12, 14, 16, 18] 26 | os: [ubuntu-latest, windows-latest, macos-latest] 27 | 28 | steps: 29 | - name: Checkout Git Source 30 | uses: actions/checkout@v2 31 | 32 | - name: Use Node.js ${{ matrix.node-version }} 33 | uses: actions/setup-node@v1 34 | with: 35 | node-version: ${{ matrix.node-version }} 36 | 37 | - name: Install Dependencies 38 | run: npm i -g npminstall && npminstall 39 | 40 | - name: Continuous Integration 41 | run: npm run ci 42 | 43 | - name: Code Coverage 44 | uses: codecov/codecov-action@v1 45 | with: 46 | token: ${{ secrets.CODECOV_TOKEN }} 47 | -------------------------------------------------------------------------------- /.github/workflows/publish-test.yml: -------------------------------------------------------------------------------- 1 | name: Npm publish test version 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | 7 | jobs: 8 | publish-gpr: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | packages: write 12 | contents: read 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v3 16 | with: 17 | fetch-depth: 0 18 | 19 | - name: Install pnpm 20 | uses: pnpm/action-setup@v2 21 | with: 22 | version: 8.5.1 23 | 24 | - name: Use Node.js ${{ matrix.node-version }} 25 | uses: actions/setup-node@v3 26 | with: 27 | node-version: 18 28 | registry-url: https://registry.npmmirror.com 29 | cache: pnpm 30 | 31 | - run: echo ${{ matrix.node-version }} 32 | - run: npm -v 33 | - run: pnpm store path 34 | - run: pnpm install 35 | 36 | # - run: npx changelogithub --no-group 37 | # continue-on-error: true 38 | # env: 39 | # NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} 40 | 41 | # - run: git config --global user.email "saqqdy@qq.com" 42 | # - run: git config --global user.name "saqqdy" 43 | 44 | # - run: pnpm run dist 45 | # env: 46 | # NODE_OPTIONS: --max-old-space-size=6144 47 | 48 | - name: Gen .npmrc 49 | run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./.npmrc 50 | 51 | - run: pnpm pub --test 52 | env: 53 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 54 | 55 | - run: curl -X PUT -d "sync_upstream=true" "https://registry-direct.npmmirror.com/egg-http-proxy-plus/sync" 56 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Npm publish 2 | 3 | on: 4 | release: 5 | types: [created] 6 | # push: 7 | # branches: [master] 8 | 9 | jobs: 10 | publish-gpr: 11 | runs-on: ubuntu-latest 12 | permissions: 13 | packages: write 14 | contents: read 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v3 18 | with: 19 | fetch-depth: 0 20 | 21 | - name: Install pnpm 22 | uses: pnpm/action-setup@v2 23 | with: 24 | version: 8.5.1 25 | 26 | - name: Use Node.js ${{ matrix.node-version }} 27 | uses: actions/setup-node@v3 28 | with: 29 | node-version: 18 30 | registry-url: https://registry.npmmirror.com 31 | cache: pnpm 32 | 33 | - run: echo ${{ matrix.node-version }} 34 | - run: npm -v 35 | - run: pnpm store path 36 | - run: pnpm install 37 | 38 | # - run: npx changelogithub --no-group 39 | # continue-on-error: true 40 | # env: 41 | # NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} 42 | 43 | # - run: git config --global user.email "saqqdy@qq.com" 44 | # - run: git config --global user.name "saqqdy" 45 | 46 | # - run: pnpm run dist 47 | # env: 48 | # NODE_OPTIONS: --max-old-space-size=6144 49 | 50 | - name: Gen .npmrc 51 | run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ./.npmrc 52 | 53 | - run: pnpm pub 54 | env: 55 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 56 | 57 | - run: curl -X PUT -d "sync_upstream=true" "https://registry-direct.npmmirror.com/egg-http-proxy-plus/sync" 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | yarn.lock 5 | /.pnp 6 | .pnp.js 7 | *.bak 8 | *_bak 9 | 10 | /tests/e2e/reports/ 11 | selenium-debug.log 12 | 13 | # local env files 14 | .DS_Store 15 | .env.local 16 | .env.development.local 17 | .env.test.local 18 | .env.production.local 19 | 20 | # testing 21 | /coverage 22 | 23 | # production 24 | 25 | # Log files 26 | npm-debug.log* 27 | yarn-debug.log* 28 | yarn-error.log* 29 | yarn.lock 30 | package-lock.json 31 | 32 | # Editor directories and files 33 | .idea 34 | .vscode 35 | *.suo 36 | *.ntvs* 37 | *.njsproj 38 | *.sln 39 | *.sw* 40 | *.bak -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "MD033": false, 3 | "MD013": false, 4 | "MD007": { 5 | "indent": 4 6 | }, 7 | "MD030": { 8 | "ol_multi": 3, 9 | "ul_single": 3 10 | }, 11 | "MD010": { 12 | "code_blocks": false 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .git 2 | node_modules 3 | /run 4 | dist 5 | public 6 | 7 | pnpm-lock.yaml 8 | 9 | *.bak 10 | *_bak 11 | *.bak.js 12 | 13 | stats.html 14 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = require('prettier-config-common') 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '10' 4 | - '12' 5 | - '14' 6 | - '16' 7 | before_install: 8 | - npm i npminstall -g 9 | install: 10 | - npminstall 11 | script: 12 | - npm run ci 13 | after_script: 14 | - npminstall codecov && codecov 15 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Logs 2 | 3 | ## 2023.05.19 v2.0.1 4 | 5 | 1. `egg` @2.x => @3.x 6 | 2. `egg-bin` @4.x => @6.x 7 | 3. `egg-ci` @1.x => @2.x 8 | 4. `egg-mock` @3.x => @5.x 9 | 5. `js-cool` @2.x => @4.x 10 | 6. upgrade all package version 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 saqqdy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # egg-http-proxy-plus 4 | 5 |
6 | 7 |
8 | 9 | 支持转发文件上传接口,支持自定义匹配方法,ctx 透传 10 | 11 |
12 | 13 |
14 | 15 | [![NPM version][npm-image]][npm-url] 16 | [![Codacy Badge][codacy-image]][codacy-url] 17 | [![Test coverage][codecov-image]][codecov-url] 18 | [![npm download][download-image]][download-url] 19 | [![License][license-image]][license-url] 20 | 21 | [![Sonar][sonar-image]][sonar-url] 22 | 23 |
24 | 25 | Configure proxy middleware for egg. Use [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware). 26 | 27 | ## Install 28 | 29 | ```bash 30 | # use npm 31 | $ npm i egg-http-proxy-plus --save 32 | 33 | # use yarn 34 | $ yarn add egg-http-proxy-plus 35 | ``` 36 | 37 | ## Usage 38 | 39 | ```js 40 | // {app_root}/config/plugin.js 41 | exports.httpProxyPlus = { 42 | enable: true, 43 | package: 'egg-http-proxy-plus' 44 | } 45 | ``` 46 | 47 | ## Configuration 48 | 49 | ### Proxy `/api` requests to `http://www.example.org` 50 | 51 | ```js 52 | // {app_root}/config/config.default.js 53 | exports.httpProxyPlus = { 54 | '/api': 'http://www.example.org' 55 | } 56 | // or 57 | exports.httpProxyPlus = [ 58 | { 59 | origin: '/api', 60 | options: 'http://www.example.org' 61 | } 62 | ] 63 | ``` 64 | 65 | #### A request to `/api/users` will now proxy the request to `http://www.example.org/api/users` 66 | 67 | If you don't want `/api` to be passed along, we need to rewrite the path: 68 | 69 | ```js 70 | // {app_root}/config/config.default.js 71 | exports.httpProxyPlus = { 72 | '/api': { 73 | target: 'http://www.example.org', 74 | pathRewrite: { '^/api': '' } 75 | } 76 | } 77 | // or 78 | exports.httpProxyPlus = [ 79 | { 80 | origin: '/api', 81 | options: { 82 | target: 'http://www.example.org', 83 | pathRewrite: { '^/api': '' } 84 | // ... 85 | } 86 | } 87 | ] 88 | ``` 89 | 90 | #### custom matching 91 | 92 | For full control you can provide a custom function to determine which requests should be proxied or not. 93 | 94 | ```js 95 | // {app_root}/config/config.default.js 96 | exports.httpProxyPlus = [ 97 | { 98 | origin(pathname, req) { 99 | return pathname.match('^/api') && req.method === 'GET' 100 | }, 101 | options: {} 102 | } 103 | ] 104 | ``` 105 | 106 | #### http-proxy events 107 | 108 | Pay attention to the fourth parameter, the plug-in transparently transmits the ctx context 109 | 110 | ```js 111 | // {app_root}/config/config.default.js 112 | exports.httpProxyPlus = { 113 | '/api': { 114 | target: 'http://www.example.org', 115 | onProxyReq(proxyReq, req, res, ctx) { 116 | if (req.method.toLowerCase() === 'post') { 117 | const token = ctx.cookies.get('access_token') 118 | token && proxyReq.setHeader('authorization', token) 119 | } 120 | } 121 | } 122 | } 123 | ``` 124 | 125 | For more advanced usages, checkout [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware#options) options documentation. 126 | 127 | ## Questions & Suggestions 128 | 129 | Please open an issue [here](https://github.com/saqqdy/egg-http-proxy-plus/issues). 130 | 131 | ## License 132 | 133 | [MIT](LICENSE) 134 | 135 | 136 | [npm-image]: https://img.shields.io/npm/v/egg-http-proxy-plus.svg?style=flat-square 137 | [npm-url]: https://npmjs.org/package/egg-http-proxy-plus 138 | [codacy-image]: https://app.codacy.com/project/badge/Grade/f70d4880e4ad4f40aa970eb9ee9d0696 139 | [codacy-url]: https://www.codacy.com/gh/saqqdy/egg-http-proxy-plus/dashboard?utm_source=github.com&utm_medium=referral&utm_content=saqqdy/egg-http-proxy-plus&utm_campaign=Badge_Grade 140 | [codecov-image]: https://img.shields.io/codecov/c/github/saqqdy/egg-http-proxy-plus.svg?style=flat-square 141 | [codecov-url]: https://codecov.io/github/saqqdy/egg-http-proxy-plus?branch=master 142 | [download-image]: https://img.shields.io/npm/dm/egg-http-proxy-plus.svg?style=flat-square 143 | [download-url]: https://npmjs.org/package/egg-http-proxy-plus 144 | [license-image]: https://img.shields.io/badge/License-MIT-blue.svg 145 | [license-url]: LICENSE 146 | [sonar-image]: https://sonarcloud.io/api/project_badges/quality_gate?project=saqqdy_egg-http-proxy-plus 147 | [sonar-url]: https://sonarcloud.io/dashboard?id=saqqdy_egg-http-proxy-plus 148 | 149 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | app.config.coreMiddleware.unshift('httpProxyPlus') 3 | } 4 | -------------------------------------------------------------------------------- /app/middleware/httpProxyPlus.js: -------------------------------------------------------------------------------- 1 | const { createProxyMiddleware } = require('http-proxy-middleware') 2 | const c2k = require('koa-connect') 3 | const pathMatching = require('egg-path-matching') 4 | const { getType } = require('js-cool') 5 | 6 | module.exports = options => { 7 | return async (ctx, next) => { 8 | const path = ctx.request.originalUrl || ctx.request.url 9 | const optType = getType(options) 10 | if (optType === 'object') { 11 | options = Object.keys(options).map(context => ({ 12 | origin: context, 13 | options: options[context] 14 | })) 15 | } 16 | for (const context of options) { 17 | let proxyOptions = context.options || {}, 18 | isMatch 19 | if (typeof proxyOptions === 'string') proxyOptions = { target: proxyOptions } 20 | const { onProxyReq = null, onProxyRes = null } = proxyOptions 21 | proxyOptions = { 22 | ...proxyOptions, 23 | // eslint-disable-next-line no-unused-vars 24 | onProxyReq(proxyReq, req, res, context = ctx) { 25 | if (onProxyReq && typeof onProxyReq === 'function') { 26 | onProxyReq(proxyReq, req, res, ctx) 27 | } 28 | const { rawBody, body: requestBody } = ctx.request 29 | if (requestBody && rawBody) { 30 | proxyReq.setHeader('Content-Length', Buffer.byteLength(rawBody)) 31 | proxyReq.write(rawBody) 32 | proxyReq.end() 33 | } 34 | return proxyReq 35 | }, 36 | // eslint-disable-next-line no-unused-vars 37 | onProxyRes(proxyRes, req, res, context = ctx) { 38 | if (onProxyRes && typeof onProxyRes === 'function') { 39 | onProxyRes(proxyRes, req, res, ctx) 40 | } 41 | return proxyRes 42 | } 43 | } 44 | if (getType(context.origin) === 'function') { 45 | // custom matching 46 | isMatch = context.origin(path.split('?')[0], ctx.req) 47 | } else { 48 | // context.origin配置的数组、字符串 49 | const match = pathMatching({ match: context.origin }) 50 | isMatch = match({ path }) 51 | } 52 | isMatch && (await c2k(createProxyMiddleware(context.origin, proxyOptions))(ctx, next)) 53 | } 54 | await next() 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | matrix: 3 | - nodejs_version: '8' 4 | - nodejs_version: '9' 5 | 6 | install: 7 | - ps: Install-Product node $env:nodejs_version 8 | - npm i npminstall && node_modules\.bin\npminstall 9 | 10 | test_script: 11 | - node --version 12 | - npm --version 13 | - npm run test 14 | 15 | build: off 16 | -------------------------------------------------------------------------------- /config/config.default.js: -------------------------------------------------------------------------------- 1 | /** 2 | * egg-http-proxy-plus default config 3 | * @member Config#httpProxyPlus 4 | * @property {String} SOME_KEY - some description 5 | */ 6 | exports.httpProxyPlus = {} 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "egg-http-proxy-plus", 3 | "description": "powerfull proxy middleware plugin for egg", 4 | "version": "2.0.1", 5 | "packageManager": "pnpm@8.5.1", 6 | "eggPlugin": { 7 | "name": "httpProxyPlus" 8 | }, 9 | "files": [ 10 | "app", 11 | "config", 12 | "app.js", 13 | "index.d.ts" 14 | ], 15 | "scripts": { 16 | "test": "pnpm run lint -- --fix && egg-bin pkgfiles && pnpm run test-local", 17 | "test-local": "egg-bin test", 18 | "cov": "egg-bin cov", 19 | "lint": "eslint .", 20 | "ci": "egg-bin pkgfiles --check && pnpm run lint && pnpm run cov", 21 | "pkgfiles": "egg-bin pkgfiles", 22 | "pub": "tscjs scripts/publish", 23 | "unpub": "tscjs scripts/unpublish", 24 | "sync": "tscjs scripts/sync", 25 | "workflow:publish-test": "zx scripts/workflow.mjs", 26 | "dist": "run-s eslint prettier", 27 | "autod": "autod", 28 | "eslint": "eslint --fix --ext .ts,.js ./", 29 | "prettier": "prettier --write \"**/*.{js,ts,json,md}\"" 30 | }, 31 | "dependencies": { 32 | "egg-path-matching": "^1.0.1", 33 | "http-proxy-middleware": "^2.0.6", 34 | "js-cool": "^4.0.0", 35 | "koa-connect": "^2.1.0" 36 | }, 37 | "devDependencies": { 38 | "@eslint-sets/eslint-config-basic": "^5.2.0", 39 | "autod": "^3.1.2", 40 | "autod-egg": "^1.1.0", 41 | "egg": "^3.16.0", 42 | "egg-bin": "^6.4.0", 43 | "egg-ci": "^2.2.0", 44 | "egg-mock": "^5.10.6", 45 | "eslint": "^8.40.0", 46 | "eslint-config-egg": "^12.2.1", 47 | "eslint-plugin-jsdoc": "^44.2.4", 48 | "load-yml": "^1.3.0", 49 | "npm-run-all": "^4.1.5", 50 | "prettier": "^2.8.8", 51 | "prettier-config-common": "^1.4.0", 52 | "reinstaller": "^3.0.0", 53 | "tsnd": "^1.1.0", 54 | "zx": "^7.2.2" 55 | }, 56 | "peerDependencyRules": { 57 | "http-proxy-middleware": ">=2", 58 | "js-cool": ">=2 <=4" 59 | }, 60 | "engines": { 61 | "node": ">=12.0.0" 62 | }, 63 | "resolutions": { 64 | "fsevents": ">= 2.0.0" 65 | }, 66 | "pnpm": { 67 | "peerDependencyRules": { 68 | "ignoreMissing": [ 69 | "@babel/core", 70 | "@types/node", 71 | "webpack", 72 | "typescript", 73 | "mocha" 74 | ], 75 | "allowedVersions": { 76 | "eslint": ">= 8.0.0", 77 | "fsevents": ">= 2.0.0" 78 | } 79 | } 80 | }, 81 | "keywords": [ 82 | "egg", 83 | "eggPlugin", 84 | "egg-plugin", 85 | "proxy", 86 | "http-proxy", 87 | "http-proxy-plus", 88 | "http-proxy-middleware" 89 | ], 90 | "publishConfig": { 91 | "registry": "https://registry.npmjs.org", 92 | "access": "public" 93 | }, 94 | "ci": { 95 | "version": "12, 14, 16, 18" 96 | }, 97 | "license": "MIT", 98 | "author": "saqqdy ", 99 | "homepage": "https://github.com/saqqdy/egg-http-proxy-plus#readme", 100 | "bugs": { 101 | "url": "https://github.com/saqqdy/egg-http-proxy-plus/issues" 102 | }, 103 | "repository": { 104 | "type": "git", 105 | "url": "git+https://github.com/saqqdy/egg-http-proxy-plus.git" 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /scripts/publish.ts: -------------------------------------------------------------------------------- 1 | import { execSync } from 'child_process' 2 | import { version } from '../package.json' 3 | 4 | const [, , ...args] = process.argv 5 | const IS_TEST = args.includes('--test') 6 | 7 | const REGISTRY_URL = 'https://registry.npmjs.org' 8 | let command = `npm --registry=${REGISTRY_URL} publish --access public` 9 | 10 | if (version.includes('rc')) command += ' --tag release' 11 | else if (version.includes('beta')) command += ' --tag beta' 12 | else if (version.includes('alpha')) command += ' --tag alpha' 13 | else if (IS_TEST) { 14 | console.warn(`${version} is not a test version, process exited`) 15 | process.exit(0) 16 | } 17 | 18 | execSync(command, { 19 | stdio: 'inherit' 20 | }) 21 | console.info('Published egg-http-proxy-plus') 22 | -------------------------------------------------------------------------------- /scripts/sync.ts: -------------------------------------------------------------------------------- 1 | import { execSync } from 'child_process' 2 | 3 | execSync('curl -X PUT -d "sync_upstream=true" "https://registry-direct.npmmirror.com/egg-http-proxy-plus/sync"') 4 | -------------------------------------------------------------------------------- /scripts/unpublish.ts: -------------------------------------------------------------------------------- 1 | import { execSync } from 'child_process' 2 | let [, , versionText] = process.argv 3 | 4 | if (!versionText) process.exit(1) 5 | versionText = versionText.replace(/\"/g, '') 6 | const versions = versionText.split(',') 7 | 8 | const REGISTRY_URL = 'https://registry.npmjs.org' 9 | const command = `npm --registry=${REGISTRY_URL} unpublish` 10 | 11 | for (const version of versions) { 12 | execSync(`${command} egg-http-proxy-plus@${version}`, { 13 | stdio: 'inherit' 14 | }) 15 | console.info(`UnPublished egg-http-proxy-plus@${version}`) 16 | } 17 | -------------------------------------------------------------------------------- /scripts/workflow.mjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zx 2 | 3 | import { execSync } from 'child_process' 4 | import { dirname, join } from 'path' 5 | import { fileURLToPath } from 'url' 6 | import { loadYmlSync } from 'load-yml' 7 | 8 | const __filename = fileURLToPath(import.meta.url) 9 | const __dirname = dirname(__filename) 10 | const [, , ...args] = process.argv 11 | 12 | const IS_ENABLE = args.includes('--enable') 13 | const WORKFLOW_PUBLISH_TEST_PATH = join(__dirname, '..', '.github', 'workflows', 'publish-test.yml') 14 | 15 | const workflowPublishTest = loadYmlSync(WORKFLOW_PUBLISH_TEST_PATH) 16 | const workflows = execSync(`gh workflow list --all`, { 17 | stdio: 'pipe' 18 | }) 19 | .toString() 20 | .replace(/\n$/, '') 21 | .split('\n') 22 | .map(item => item.split('\t')) 23 | for (const [name, status, id] of workflows) { 24 | if (name === workflowPublishTest.name) { 25 | !(!IS_ENABLE && status !== 'active') && 26 | execSync(`gh workflow ${IS_ENABLE ? 'enable' : 'disable'} ${id}`, { 27 | stdio: 'inherit' 28 | }) 29 | break 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /sonar-project.properties: -------------------------------------------------------------------------------- 1 | sonar.projectKey=saqqdy_egg-http-proxy-plus 2 | sonar.organization=saqqdy 3 | sonar.coverage.exclusions=build/* 4 | 5 | # This is the name and version displayed in the SonarCloud UI. 6 | #sonar.projectName=egg-http-proxy-plus 7 | #sonar.projectVersion=1.0 8 | 9 | # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. 10 | sonar.sources=src 11 | 12 | # Encoding of the source code. Default is default system encoding 13 | #sonar.sourceEncoding=UTF-8 14 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/app/controller/home.js: -------------------------------------------------------------------------------- 1 | const Controller = require('egg').Controller 2 | 3 | class HomeController extends Controller { 4 | async index() { 5 | this.ctx.body = 'hi, ' + this.app.plugins.httpProxyPlus.name 6 | } 7 | } 8 | 9 | module.exports = HomeController 10 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/app/router.js: -------------------------------------------------------------------------------- 1 | module.exports = app => { 2 | const { router, controller } = app 3 | 4 | router.get('/', controller.home.index) 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/config/config.default.js: -------------------------------------------------------------------------------- 1 | exports.keys = '123456' 2 | 3 | exports.httpProxyPlus = { 4 | '/proxy1': 'http://localhost:3000', 5 | '/api/proxy2': { 6 | target: 'http://localhost:3001', 7 | pathRewrite: { '^/api': '' } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/config/plugin.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | exports.httpProxyPlus = { 4 | enable: true, 5 | path: path.join(__dirname, '../../../../../') 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/logs/http-proxy-test/common-error.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saqqdy/egg-http-proxy-plus/b68abf12498042301e437aa9506c92fdbbd5840b/test/fixtures/apps/http-proxy-test/logs/http-proxy-test/common-error.log -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/logs/http-proxy-test/egg-agent.log: -------------------------------------------------------------------------------- 1 | 2021-09-20 14:43:33,095 INFO 88366 [egg:logger] init all loggers with options: {"dir":"/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/logs/http-proxy-test","encoding":"utf8","env":"unittest","level":"INFO","consoleLevel":"WARN","disableConsoleAfterReady":false,"outputJSON":false,"buffer":false,"appLogName":"http-proxy-test-web.log","coreLogName":"egg-web.log","agentLogName":"egg-agent.log","errorLogName":"common-error.log","coreLogger":{},"allowDebugAtProd":false,"type":"agent"} 2 | 2021-09-20 14:43:33,100 INFO 88366 [egg:core] dump config after load, 2ms 3 | 2021-09-20 14:43:33,139 INFO 88366 [egg-watcher:agent] watcher start success 4 | 2021-09-20 14:43:33,143 INFO 88366 [egg:core] dump config after ready, 3ms 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/logs/http-proxy-test/egg-schedule.log: -------------------------------------------------------------------------------- 1 | 2021-09-20 14:43:33,252 INFO 88366 [egg-schedule]: register schedule /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/app/schedule/clean_tmpdir.js 2 | 2021-09-20 14:43:33,252 INFO 88366 [egg-schedule]: register schedule /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app/schedule/clean_log.js 3 | 2021-09-20 14:43:33,252 INFO 88366 [egg-schedule]: register schedule /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app/schedule/rotate_by_file.js 4 | 2021-09-20 14:43:33,517 INFO 88366 [Timer] /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/app/schedule/clean_tmpdir.js next time will execute after 49586485ms at 2021-09-21 04:30:00.002 5 | 2021-09-20 14:43:33,517 INFO 88366 [Timer] /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app/schedule/clean_log.js next time will execute after 33386483ms at 2021-09-21 00:00:00.000 6 | 2021-09-20 14:43:33,517 INFO 88366 [Timer] /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app/schedule/rotate_by_file.js next time will execute after 33387483ms at 2021-09-21 00:00:01.000 7 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/logs/http-proxy-test/egg-web.log: -------------------------------------------------------------------------------- 1 | 2021-09-20 14:43:33,248 INFO 88366 [egg:logger] init all loggers with options: {"dir":"/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/logs/http-proxy-test","encoding":"utf8","env":"unittest","level":"INFO","consoleLevel":"WARN","disableConsoleAfterReady":false,"outputJSON":false,"buffer":false,"appLogName":"http-proxy-test-web.log","coreLogName":"egg-web.log","agentLogName":"egg-agent.log","errorLogName":"common-error.log","coreLogger":{},"allowDebugAtProd":false,"type":"application"} 2 | 2021-09-20 14:43:33,253 INFO 88366 [egg-multipart] stream mode enable 3 | 2021-09-20 14:43:33,484 INFO 88366 [egg-static] starting static serve /public/ -> /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/app/public 4 | 2021-09-20 14:43:33,486 INFO 88366 [egg-security] use csrf middleware 5 | 2021-09-20 14:43:33,488 INFO 88366 [egg-security] use methodnoallow middleware 6 | 2021-09-20 14:43:33,489 INFO 88366 [egg-security] use noopen middleware 7 | 2021-09-20 14:43:33,490 INFO 88366 [egg-security] use nosniff middleware 8 | 2021-09-20 14:43:33,490 INFO 88366 [egg-security] use xssProtection middleware 9 | 2021-09-20 14:43:33,491 INFO 88366 [egg-security] use xframe middleware 10 | 2021-09-20 14:43:33,492 INFO 88366 [egg-security] use dta middleware 11 | 2021-09-20 14:43:33,492 INFO 88366 [egg-security] compose 7 middlewares into one security middleware 12 | 2021-09-20 14:43:33,503 INFO 88366 [egg:core] dump config after load, 3ms 13 | 2021-09-20 14:43:33,510 INFO 88366 [egg-watcher:application] watcher start success 14 | 2021-09-20 14:43:33,514 INFO 88366 [egg:core] dump config after ready, 3ms 15 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/logs/http-proxy-test/http-proxy-test-web.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saqqdy/egg-http-proxy-plus/b68abf12498042301e437aa9506c92fdbbd5840b/test/fixtures/apps/http-proxy-test/logs/http-proxy-test/http-proxy-test-web.log -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "http-proxy-test", 3 | "version": "0.0.1" 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/run/agent_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "session": { 4 | "maxAge": 86400000, 5 | "key": "EGG_SESS", 6 | "httpOnly": true, 7 | "encrypt": true, 8 | "logValue": true 9 | }, 10 | "security": { 11 | "domainWhiteList": [], 12 | "protocolWhiteList": [], 13 | "defaultMiddleware": "csrf,hsts,methodnoallow,noopen,nosniff,csp,xssProtection,xframe,dta", 14 | "csrf": { 15 | "enable": true, 16 | "type": "ctoken", 17 | "ignoreJSON": false, 18 | "useSession": false, 19 | "cookieName": "csrfToken", 20 | "sessionName": "csrfToken", 21 | "headerName": "x-csrf-token", 22 | "bodyName": "_csrf", 23 | "queryName": "_csrf", 24 | "refererWhiteList": [] 25 | }, 26 | "xframe": { 27 | "enable": true, 28 | "value": "SAMEORIGIN" 29 | }, 30 | "hsts": { 31 | "enable": false, 32 | "maxAge": 31536000, 33 | "includeSubdomains": false 34 | }, 35 | "dta": { 36 | "enable": true 37 | }, 38 | "methodnoallow": { 39 | "enable": true 40 | }, 41 | "noopen": { 42 | "enable": true 43 | }, 44 | "nosniff": { 45 | "enable": true 46 | }, 47 | "referrerPolicy": { 48 | "enable": false, 49 | "value": "no-referrer-when-downgrade" 50 | }, 51 | "xssProtection": { 52 | "enable": true, 53 | "value": "1; mode=block" 54 | }, 55 | "csp": { 56 | "enable": false, 57 | "policy": {} 58 | }, 59 | "ssrf": { 60 | "ipBlackList": null, 61 | "ipExceptionList": null, 62 | "checkAddress": null 63 | }, 64 | "_protocolWhiteListSet": "" 65 | }, 66 | "helper": { 67 | "shtml": {} 68 | }, 69 | "jsonp": { 70 | "limit": 50, 71 | "callback": ["_callback", "callback"], 72 | "csrf": false 73 | }, 74 | "onerror": { 75 | "errorPageUrl": "", 76 | "appErrorFilter": null, 77 | "templatePath": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/lib/onerror_page.mustache" 78 | }, 79 | "i18n": { 80 | "defaultLocale": "en_US", 81 | "dirs": [], 82 | "queryField": "locale", 83 | "cookieField": "locale", 84 | "cookieDomain": "", 85 | "cookieMaxAge": "1y" 86 | }, 87 | "watcher": { 88 | "type": "development", 89 | "eventSources": { 90 | "default": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/lib/event-sources/default", 91 | "development": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/lib/event-sources/development" 92 | } 93 | }, 94 | "customLogger": { 95 | "scheduleLogger": { 96 | "consoleLevel": "NONE", 97 | "file": "egg-schedule.log" 98 | } 99 | }, 100 | "schedule": { 101 | "directory": [] 102 | }, 103 | "multipart": { 104 | "mode": "stream", 105 | "autoFields": false, 106 | "defaultCharset": "utf8", 107 | "fieldNameSize": 100, 108 | "fieldSize": "100kb", 109 | "fields": 10, 110 | "fileSize": "10mb", 111 | "files": 10, 112 | "fileExtensions": [], 113 | "whitelist": null, 114 | "allowArrayField": false, 115 | "tmpdir": "/var/folders/7c/99zpwkdd5jb44ln7f2d3_nt40000gn/T/egg-multipart-tmp/http-proxy-test", 116 | "cleanSchedule": { 117 | "cron": "0 30 4 * * *", 118 | "disable": false 119 | } 120 | }, 121 | "logrotator": { 122 | "filesRotateByHour": null, 123 | "hourDelimiter": "-", 124 | "filesRotateBySize": null, 125 | "maxFileSize": 52428800, 126 | "maxFiles": 10, 127 | "rotateDuration": 60000, 128 | "maxDays": 31 129 | }, 130 | "static": { 131 | "prefix": "/public/", 132 | "dir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/app/public", 133 | "dynamic": true, 134 | "preload": false, 135 | "buffer": false, 136 | "maxFiles": 1000 137 | }, 138 | "view": { 139 | "root": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/app/view", 140 | "cache": true, 141 | "defaultExtension": ".html", 142 | "defaultViewEngine": "", 143 | "mapping": {} 144 | }, 145 | "httpProxyPlus": { 146 | "/proxy1": "http://localhost:3000", 147 | "/api/proxy2": { 148 | "target": "http://localhost:3001", 149 | "pathRewrite": { 150 | "^/api": "" 151 | } 152 | } 153 | }, 154 | "env": "unittest", 155 | "name": "http-proxy-test", 156 | "keys": "", 157 | "cookies": {}, 158 | "proxy": false, 159 | "maxIpsCount": 0, 160 | "maxProxyCount": 0, 161 | "protocolHeaders": "x-forwarded-proto", 162 | "ipHeaders": "x-forwarded-for", 163 | "hostHeaders": "", 164 | "pkg": { 165 | "name": "http-proxy-test", 166 | "version": "0.0.1" 167 | }, 168 | "baseDir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test", 169 | "HOME": "/Users/saqqdy", 170 | "rundir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/run", 171 | "dump": { 172 | "ignore": "" 173 | }, 174 | "confusedConfigurations": { 175 | "bodyparser": "bodyParser", 176 | "notFound": "notfound", 177 | "sitefile": "siteFile", 178 | "middlewares": "middleware", 179 | "httpClient": "httpclient" 180 | }, 181 | "notfound": { 182 | "pageUrl": "" 183 | }, 184 | "siteFile": { 185 | "/favicon.ico": "" 186 | }, 187 | "bodyParser": { 188 | "enable": true, 189 | "encoding": "utf8", 190 | "formLimit": "1mb", 191 | "jsonLimit": "1mb", 192 | "textLimit": "1mb", 193 | "strict": true, 194 | "queryString": { 195 | "arrayLimit": 100, 196 | "depth": 5, 197 | "parameterLimit": 1000 198 | }, 199 | "onerror": "" 200 | }, 201 | "logger": { 202 | "dir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/logs/http-proxy-test", 203 | "encoding": "utf8", 204 | "env": "unittest", 205 | "level": "INFO", 206 | "consoleLevel": "WARN", 207 | "disableConsoleAfterReady": false, 208 | "outputJSON": false, 209 | "buffer": false, 210 | "appLogName": "http-proxy-test-web.log", 211 | "coreLogName": "egg-web.log", 212 | "agentLogName": "egg-agent.log", 213 | "errorLogName": "common-error.log", 214 | "coreLogger": {}, 215 | "allowDebugAtProd": false, 216 | "type": "agent" 217 | }, 218 | "httpclient": { 219 | "enableDNSCache": false, 220 | "dnsCacheLookupInterval": 10000, 221 | "dnsCacheMaxLength": 1000, 222 | "request": { 223 | "timeout": 5000 224 | }, 225 | "httpAgent": { 226 | "keepAlive": true, 227 | "freeSocketTimeout": 4000, 228 | "maxSockets": 9007199254740991, 229 | "maxFreeSockets": 256 230 | }, 231 | "httpsAgent": { 232 | "keepAlive": true, 233 | "freeSocketTimeout": 4000, 234 | "maxSockets": 9007199254740991, 235 | "maxFreeSockets": 256 236 | } 237 | }, 238 | "meta": { 239 | "enable": true, 240 | "logging": false 241 | }, 242 | "coreMiddleware": ["meta", "siteFile", "notfound", "bodyParser", "overrideMethod"], 243 | "workerStartTimeout": 600000, 244 | "serverTimeout": null, 245 | "cluster": { 246 | "listen": { 247 | "path": "", 248 | "port": 7001, 249 | "hostname": "" 250 | } 251 | }, 252 | "clusterClient": { 253 | "maxWaitTime": 60000, 254 | "responseTimeout": 60000 255 | }, 256 | "onClientError": null, 257 | "coreMiddlewares": "~config~coreMiddleware", 258 | "appMiddlewares": [], 259 | "appMiddleware": "~config~appMiddlewares" 260 | }, 261 | "plugins": { 262 | "onerror": { 263 | "enable": true, 264 | "package": "egg-onerror", 265 | "name": "onerror", 266 | "dependencies": [], 267 | "optionalDependencies": ["jsonp"], 268 | "env": [], 269 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 270 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror", 271 | "version": "2.1.0" 272 | }, 273 | "session": { 274 | "enable": true, 275 | "package": "egg-session", 276 | "name": "session", 277 | "dependencies": [], 278 | "optionalDependencies": [], 279 | "env": [], 280 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 281 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session", 282 | "version": "3.3.0" 283 | }, 284 | "i18n": { 285 | "enable": true, 286 | "package": "egg-i18n", 287 | "name": "i18n", 288 | "dependencies": [], 289 | "optionalDependencies": [], 290 | "env": [], 291 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 292 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n", 293 | "version": "2.1.1" 294 | }, 295 | "watcher": { 296 | "enable": true, 297 | "package": "egg-watcher", 298 | "name": "watcher", 299 | "dependencies": [], 300 | "optionalDependencies": [], 301 | "env": [], 302 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 303 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher", 304 | "version": "3.1.1" 305 | }, 306 | "multipart": { 307 | "enable": true, 308 | "package": "egg-multipart", 309 | "name": "multipart", 310 | "dependencies": [], 311 | "optionalDependencies": ["schedule"], 312 | "env": [], 313 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 314 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart", 315 | "version": "2.13.1" 316 | }, 317 | "security": { 318 | "enable": true, 319 | "package": "egg-security", 320 | "name": "security", 321 | "dependencies": [], 322 | "optionalDependencies": ["session"], 323 | "env": [], 324 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 325 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security", 326 | "version": "2.9.0" 327 | }, 328 | "development": { 329 | "enable": false, 330 | "package": "egg-development", 331 | "name": "development", 332 | "dependencies": ["watcher"], 333 | "optionalDependencies": [], 334 | "env": ["local"], 335 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 336 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-development", 337 | "version": "2.7.0" 338 | }, 339 | "logrotator": { 340 | "enable": true, 341 | "package": "egg-logrotator", 342 | "name": "logrotator", 343 | "dependencies": ["schedule"], 344 | "optionalDependencies": [], 345 | "env": [], 346 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 347 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator", 348 | "version": "3.1.0" 349 | }, 350 | "schedule": { 351 | "enable": true, 352 | "package": "egg-schedule", 353 | "name": "schedule", 354 | "dependencies": [], 355 | "optionalDependencies": [], 356 | "env": [], 357 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 358 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule", 359 | "version": "3.6.6" 360 | }, 361 | "static": { 362 | "enable": true, 363 | "package": "egg-static", 364 | "name": "static", 365 | "dependencies": [], 366 | "optionalDependencies": [], 367 | "env": [], 368 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 369 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static", 370 | "version": "2.2.0" 371 | }, 372 | "jsonp": { 373 | "enable": true, 374 | "package": "egg-jsonp", 375 | "name": "jsonp", 376 | "dependencies": [], 377 | "optionalDependencies": ["security"], 378 | "env": [], 379 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 380 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp", 381 | "version": "2.0.0" 382 | }, 383 | "view": { 384 | "enable": true, 385 | "package": "egg-view", 386 | "name": "view", 387 | "dependencies": [], 388 | "optionalDependencies": [], 389 | "env": [], 390 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 391 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view", 392 | "version": "2.1.3" 393 | }, 394 | "httpProxyPlus": { 395 | "enable": true, 396 | "name": "httpProxyPlus", 397 | "dependencies": [], 398 | "optionalDependencies": [], 399 | "env": [], 400 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/plugin.js", 401 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus", 402 | "version": "1.1.0" 403 | }, 404 | "egg-mock": { 405 | "enable": true, 406 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock", 407 | "name": "egg-mock", 408 | "dependencies": [], 409 | "optionalDependencies": [], 410 | "env": [], 411 | "version": "3.26.0" 412 | } 413 | } 414 | } 415 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/run/agent_config_meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "keys": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/config.default.js", 3 | "httpProxyPlus": { 4 | "/proxy1": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/config.default.js", 5 | "/api/proxy2": { 6 | "target": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/config.default.js", 7 | "pathRewrite": { 8 | "^/api": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/config.default.js" 9 | } 10 | } 11 | }, 12 | "session": { 13 | "maxAge": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 14 | "key": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 15 | "httpOnly": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 16 | "encrypt": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 17 | "logValue": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js" 18 | }, 19 | "security": { 20 | "domainWhiteList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 21 | "protocolWhiteList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 22 | "defaultMiddleware": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 23 | "csrf": { 24 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 25 | "type": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 26 | "ignoreJSON": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 27 | "useSession": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 28 | "cookieName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 29 | "sessionName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 30 | "headerName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 31 | "bodyName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 32 | "queryName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 33 | "refererWhiteList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 34 | }, 35 | "xframe": { 36 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 37 | "value": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 38 | }, 39 | "hsts": { 40 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 41 | "maxAge": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 42 | "includeSubdomains": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 43 | }, 44 | "dta": { 45 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 46 | }, 47 | "methodnoallow": { 48 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 49 | }, 50 | "noopen": { 51 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 52 | }, 53 | "nosniff": { 54 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 55 | }, 56 | "referrerPolicy": { 57 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 58 | "value": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 59 | }, 60 | "xssProtection": { 61 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 62 | "value": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 63 | }, 64 | "csp": { 65 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 66 | "policy": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 67 | }, 68 | "ssrf": { 69 | "ipBlackList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 70 | "ipExceptionList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 71 | "checkAddress": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 72 | } 73 | }, 74 | "helper": { 75 | "shtml": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 76 | }, 77 | "jsonp": { 78 | "limit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js", 79 | "callback": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js", 80 | "csrf": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js" 81 | }, 82 | "onerror": { 83 | "errorPageUrl": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js", 84 | "appErrorFilter": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js", 85 | "templatePath": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js" 86 | }, 87 | "i18n": { 88 | "defaultLocale": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 89 | "dirs": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 90 | "queryField": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 91 | "cookieField": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 92 | "cookieDomain": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 93 | "cookieMaxAge": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js" 94 | }, 95 | "watcher": { 96 | "type": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.unittest.js", 97 | "eventSources": { 98 | "default": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.default.js", 99 | "development": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.default.js" 100 | } 101 | }, 102 | "customLogger": { 103 | "scheduleLogger": { 104 | "consoleLevel": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js", 105 | "file": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js" 106 | } 107 | }, 108 | "schedule": { 109 | "directory": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js" 110 | }, 111 | "multipart": { 112 | "mode": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 113 | "autoFields": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 114 | "defaultCharset": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 115 | "fieldNameSize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 116 | "fieldSize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 117 | "fields": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 118 | "fileSize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 119 | "files": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 120 | "fileExtensions": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 121 | "whitelist": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 122 | "allowArrayField": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 123 | "tmpdir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 124 | "cleanSchedule": { 125 | "cron": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 126 | "disable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js" 127 | } 128 | }, 129 | "logrotator": { 130 | "filesRotateByHour": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 131 | "hourDelimiter": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 132 | "filesRotateBySize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 133 | "maxFileSize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 134 | "maxFiles": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 135 | "rotateDuration": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 136 | "maxDays": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js" 137 | }, 138 | "static": { 139 | "prefix": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 140 | "dir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 141 | "dynamic": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 142 | "preload": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 143 | "buffer": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 144 | "maxFiles": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js" 145 | }, 146 | "view": { 147 | "root": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 148 | "cache": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 149 | "defaultExtension": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 150 | "defaultViewEngine": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 151 | "mapping": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js" 152 | }, 153 | "env": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 154 | "name": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 155 | "cookies": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 156 | "proxy": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 157 | "maxIpsCount": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 158 | "maxProxyCount": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 159 | "protocolHeaders": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 160 | "ipHeaders": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 161 | "hostHeaders": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 162 | "pkg": { 163 | "name": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 164 | "version": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 165 | }, 166 | "baseDir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 167 | "HOME": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 168 | "rundir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 169 | "dump": { 170 | "ignore": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 171 | }, 172 | "confusedConfigurations": { 173 | "bodyparser": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 174 | "notFound": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 175 | "sitefile": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 176 | "middlewares": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 177 | "httpClient": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 178 | }, 179 | "notfound": { 180 | "pageUrl": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 181 | }, 182 | "siteFile": { 183 | "/favicon.ico": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 184 | }, 185 | "bodyParser": { 186 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 187 | "encoding": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 188 | "formLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 189 | "jsonLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 190 | "textLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 191 | "strict": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 192 | "queryString": { 193 | "arrayLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 194 | "depth": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 195 | "parameterLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 196 | }, 197 | "onerror": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 198 | }, 199 | "logger": { 200 | "dir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 201 | "encoding": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 202 | "env": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 203 | "level": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 204 | "consoleLevel": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.unittest.js", 205 | "disableConsoleAfterReady": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 206 | "outputJSON": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 207 | "buffer": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.unittest.js", 208 | "appLogName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 209 | "coreLogName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 210 | "agentLogName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 211 | "errorLogName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 212 | "coreLogger": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 213 | "allowDebugAtProd": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 214 | }, 215 | "httpclient": { 216 | "enableDNSCache": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 217 | "dnsCacheLookupInterval": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 218 | "dnsCacheMaxLength": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 219 | "request": { 220 | "timeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 221 | }, 222 | "httpAgent": { 223 | "keepAlive": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 224 | "freeSocketTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 225 | "maxSockets": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 226 | "maxFreeSockets": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 227 | }, 228 | "httpsAgent": { 229 | "keepAlive": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 230 | "freeSocketTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 231 | "maxSockets": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 232 | "maxFreeSockets": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 233 | } 234 | }, 235 | "meta": { 236 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 237 | "logging": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 238 | }, 239 | "coreMiddleware": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 240 | "workerStartTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 241 | "serverTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 242 | "cluster": { 243 | "listen": { 244 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 245 | "port": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 246 | "hostname": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 247 | } 248 | }, 249 | "clusterClient": { 250 | "maxWaitTime": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 251 | "responseTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 252 | }, 253 | "onClientError": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 254 | } 255 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/run/agent_timing_84615.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Process Start", 4 | "start": 1632118570933, 5 | "end": 1632118572104, 6 | "duration": 1171, 7 | "pid": 84615, 8 | "index": 0 9 | }, 10 | { 11 | "name": "Application Start", 12 | "start": 1632118572104, 13 | "end": 1632118572329, 14 | "duration": 225, 15 | "pid": 84615, 16 | "index": 1 17 | }, 18 | { 19 | "name": "Load Plugin", 20 | "start": 1632118572107, 21 | "end": 1632118572119, 22 | "duration": 12, 23 | "pid": 84615, 24 | "index": 2 25 | }, 26 | { 27 | "name": "Load Config", 28 | "start": 1632118572119, 29 | "end": 1632118572168, 30 | "duration": 49, 31 | "pid": 84615, 32 | "index": 3 33 | }, 34 | { 35 | "name": "Require(0) config/config.default.js", 36 | "start": 1632118572119, 37 | "end": 1632118572122, 38 | "duration": 3, 39 | "pid": 84615, 40 | "index": 4 41 | }, 42 | { 43 | "name": "Require(1) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 44 | "start": 1632118572123, 45 | "end": 1632118572125, 46 | "duration": 2, 47 | "pid": 84615, 48 | "index": 5 49 | }, 50 | { 51 | "name": "Require(2) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 52 | "start": 1632118572125, 53 | "end": 1632118572126, 54 | "duration": 1, 55 | "pid": 84615, 56 | "index": 6 57 | }, 58 | { 59 | "name": "Require(3) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js", 60 | "start": 1632118572127, 61 | "end": 1632118572127, 62 | "duration": 0, 63 | "pid": 84615, 64 | "index": 7 65 | }, 66 | { 67 | "name": "Require(4) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js", 68 | "start": 1632118572128, 69 | "end": 1632118572129, 70 | "duration": 1, 71 | "pid": 84615, 72 | "index": 8 73 | }, 74 | { 75 | "name": "Require(5) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 76 | "start": 1632118572129, 77 | "end": 1632118572130, 78 | "duration": 1, 79 | "pid": 84615, 80 | "index": 9 81 | }, 82 | { 83 | "name": "Require(6) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.default.js", 84 | "start": 1632118572130, 85 | "end": 1632118572131, 86 | "duration": 1, 87 | "pid": 84615, 88 | "index": 10 89 | }, 90 | { 91 | "name": "Require(7) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js", 92 | "start": 1632118572131, 93 | "end": 1632118572132, 94 | "duration": 1, 95 | "pid": 84615, 96 | "index": 11 97 | }, 98 | { 99 | "name": "Require(8) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 100 | "start": 1632118572132, 101 | "end": 1632118572133, 102 | "duration": 1, 103 | "pid": 84615, 104 | "index": 12 105 | }, 106 | { 107 | "name": "Require(9) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 108 | "start": 1632118572133, 109 | "end": 1632118572134, 110 | "duration": 1, 111 | "pid": 84615, 112 | "index": 13 113 | }, 114 | { 115 | "name": "Require(10) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 116 | "start": 1632118572134, 117 | "end": 1632118572135, 118 | "duration": 1, 119 | "pid": 84615, 120 | "index": 14 121 | }, 122 | { 123 | "name": "Require(11) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 124 | "start": 1632118572135, 125 | "end": 1632118572136, 126 | "duration": 1, 127 | "pid": 84615, 128 | "index": 15 129 | }, 130 | { 131 | "name": "Require(12) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/config/config.default.js", 132 | "start": 1632118572136, 133 | "end": 1632118572161, 134 | "duration": 25, 135 | "pid": 84615, 136 | "index": 16 137 | }, 138 | { 139 | "name": "Require(13) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 140 | "start": 1632118572161, 141 | "end": 1632118572163, 142 | "duration": 2, 143 | "pid": 84615, 144 | "index": 17 145 | }, 146 | { 147 | "name": "Require(14) config/config.default.js", 148 | "start": 1632118572165, 149 | "end": 1632118572165, 150 | "duration": 0, 151 | "pid": 84615, 152 | "index": 18 153 | }, 154 | { 155 | "name": "Require(15) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.unittest.js", 156 | "start": 1632118572165, 157 | "end": 1632118572166, 158 | "duration": 1, 159 | "pid": 84615, 160 | "index": 19 161 | }, 162 | { 163 | "name": "Require(16) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.unittest.js", 164 | "start": 1632118572167, 165 | "end": 1632118572167, 166 | "duration": 0, 167 | "pid": 84615, 168 | "index": 20 169 | }, 170 | { 171 | "name": "Load extend/agent.js", 172 | "start": 1632118572168, 173 | "end": 1632118572202, 174 | "duration": 34, 175 | "pid": 84615, 176 | "index": 21 177 | }, 178 | { 179 | "name": "Require(17) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/agent.js", 180 | "start": 1632118572168, 181 | "end": 1632118572170, 182 | "duration": 2, 183 | "pid": 84615, 184 | "index": 22 185 | }, 186 | { 187 | "name": "Require(18) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/app/extend/agent.js", 188 | "start": 1632118572171, 189 | "end": 1632118572198, 190 | "duration": 27, 191 | "pid": 84615, 192 | "index": 23 193 | }, 194 | { 195 | "name": "Require(19) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app/extend/agent.js", 196 | "start": 1632118572198, 197 | "end": 1632118572200, 198 | "duration": 2, 199 | "pid": 84615, 200 | "index": 24 201 | }, 202 | { 203 | "name": "Require(20) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock/app/extend/agent.js", 204 | "start": 1632118572200, 205 | "end": 1632118572202, 206 | "duration": 2, 207 | "pid": 84615, 208 | "index": 25 209 | }, 210 | { 211 | "name": "Load extend/context.js", 212 | "start": 1632118572202, 213 | "end": 1632118572271, 214 | "duration": 69, 215 | "pid": 84615, 216 | "index": 26 217 | }, 218 | { 219 | "name": "Require(21) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/context.js", 220 | "start": 1632118572203, 221 | "end": 1632118572210, 222 | "duration": 7, 223 | "pid": 84615, 224 | "index": 27 225 | }, 226 | { 227 | "name": "Require(22) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/app/extend/context.js", 228 | "start": 1632118572210, 229 | "end": 1632118572213, 230 | "duration": 3, 231 | "pid": 84615, 232 | "index": 28 233 | }, 234 | { 235 | "name": "Require(23) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/app/extend/context.js", 236 | "start": 1632118572214, 237 | "end": 1632118572214, 238 | "duration": 0, 239 | "pid": 84615, 240 | "index": 29 241 | }, 242 | { 243 | "name": "Require(24) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/app/extend/context.js", 244 | "start": 1632118572215, 245 | "end": 1632118572266, 246 | "duration": 51, 247 | "pid": 84615, 248 | "index": 30 249 | }, 250 | { 251 | "name": "Require(25) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/app/extend/context.js", 252 | "start": 1632118572266, 253 | "end": 1632118572268, 254 | "duration": 2, 255 | "pid": 84615, 256 | "index": 31 257 | }, 258 | { 259 | "name": "Require(26) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/context.js", 260 | "start": 1632118572268, 261 | "end": 1632118572270, 262 | "duration": 2, 263 | "pid": 84615, 264 | "index": 32 265 | }, 266 | { 267 | "name": "Load agent.js", 268 | "start": 1632118572271, 269 | "end": 1632118572282, 270 | "duration": 11, 271 | "pid": 84615, 272 | "index": 33 273 | }, 274 | { 275 | "name": "Require(27) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/agent.js", 276 | "start": 1632118572271, 277 | "end": 1632118572272, 278 | "duration": 1, 279 | "pid": 84615, 280 | "index": 34 281 | }, 282 | { 283 | "name": "Require(28) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/agent.js", 284 | "start": 1632118572272, 285 | "end": 1632118572273, 286 | "duration": 1, 287 | "pid": 84615, 288 | "index": 35 289 | }, 290 | { 291 | "name": "Require(29) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/agent.js", 292 | "start": 1632118572273, 293 | "end": 1632118572276, 294 | "duration": 3, 295 | "pid": 84615, 296 | "index": 36 297 | }, 298 | { 299 | "name": "Require(30) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/agent.js", 300 | "start": 1632118572276, 301 | "end": 1632118572278, 302 | "duration": 2, 303 | "pid": 84615, 304 | "index": 37 305 | }, 306 | { 307 | "name": "Require(31) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/agent.js", 308 | "start": 1632118572278, 309 | "end": 1632118572279, 310 | "duration": 1, 311 | "pid": 84615, 312 | "index": 38 313 | }, 314 | { 315 | "name": "Require(32) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/agent.js", 316 | "start": 1632118572279, 317 | "end": 1632118572282, 318 | "duration": 3, 319 | "pid": 84615, 320 | "index": 39 321 | }, 322 | { 323 | "name": "Before Start in /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/lib/init.js:15:14", 324 | "start": 1632118572287, 325 | "end": 1632118572329, 326 | "duration": 42, 327 | "pid": 84615, 328 | "index": 40 329 | }, 330 | { 331 | "name": "Before Start in /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/agent.js:12:9", 332 | "start": 1632118572288, 333 | "end": 1632118572313, 334 | "duration": 25, 335 | "pid": 84615, 336 | "index": 41 337 | } 338 | ] 339 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/run/agent_timing_88366.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Process Start", 4 | "start": 1632120211455, 5 | "end": 1632120212918, 6 | "duration": 1463, 7 | "pid": 88366, 8 | "index": 0 9 | }, 10 | { 11 | "name": "Application Start", 12 | "start": 1632120212918, 13 | "end": 1632120213140, 14 | "duration": 222, 15 | "pid": 88366, 16 | "index": 1 17 | }, 18 | { 19 | "name": "Load Plugin", 20 | "start": 1632120212921, 21 | "end": 1632120212945, 22 | "duration": 24, 23 | "pid": 88366, 24 | "index": 2 25 | }, 26 | { 27 | "name": "Load Config", 28 | "start": 1632120212945, 29 | "end": 1632120212972, 30 | "duration": 27, 31 | "pid": 88366, 32 | "index": 3 33 | }, 34 | { 35 | "name": "Require(0) config/config.default.js", 36 | "start": 1632120212946, 37 | "end": 1632120212949, 38 | "duration": 3, 39 | "pid": 88366, 40 | "index": 4 41 | }, 42 | { 43 | "name": "Require(1) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 44 | "start": 1632120212950, 45 | "end": 1632120212950, 46 | "duration": 0, 47 | "pid": 88366, 48 | "index": 5 49 | }, 50 | { 51 | "name": "Require(2) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 52 | "start": 1632120212951, 53 | "end": 1632120212951, 54 | "duration": 0, 55 | "pid": 88366, 56 | "index": 6 57 | }, 58 | { 59 | "name": "Require(3) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js", 60 | "start": 1632120212952, 61 | "end": 1632120212953, 62 | "duration": 1, 63 | "pid": 88366, 64 | "index": 7 65 | }, 66 | { 67 | "name": "Require(4) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js", 68 | "start": 1632120212953, 69 | "end": 1632120212954, 70 | "duration": 1, 71 | "pid": 88366, 72 | "index": 8 73 | }, 74 | { 75 | "name": "Require(5) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 76 | "start": 1632120212954, 77 | "end": 1632120212955, 78 | "duration": 1, 79 | "pid": 88366, 80 | "index": 9 81 | }, 82 | { 83 | "name": "Require(6) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.default.js", 84 | "start": 1632120212956, 85 | "end": 1632120212956, 86 | "duration": 0, 87 | "pid": 88366, 88 | "index": 10 89 | }, 90 | { 91 | "name": "Require(7) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js", 92 | "start": 1632120212957, 93 | "end": 1632120212958, 94 | "duration": 1, 95 | "pid": 88366, 96 | "index": 11 97 | }, 98 | { 99 | "name": "Require(8) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 100 | "start": 1632120212958, 101 | "end": 1632120212959, 102 | "duration": 1, 103 | "pid": 88366, 104 | "index": 12 105 | }, 106 | { 107 | "name": "Require(9) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 108 | "start": 1632120212960, 109 | "end": 1632120212960, 110 | "duration": 0, 111 | "pid": 88366, 112 | "index": 13 113 | }, 114 | { 115 | "name": "Require(10) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 116 | "start": 1632120212961, 117 | "end": 1632120212961, 118 | "duration": 0, 119 | "pid": 88366, 120 | "index": 14 121 | }, 122 | { 123 | "name": "Require(11) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 124 | "start": 1632120212962, 125 | "end": 1632120212963, 126 | "duration": 1, 127 | "pid": 88366, 128 | "index": 15 129 | }, 130 | { 131 | "name": "Require(12) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/config/config.default.js", 132 | "start": 1632120212963, 133 | "end": 1632120212965, 134 | "duration": 2, 135 | "pid": 88366, 136 | "index": 16 137 | }, 138 | { 139 | "name": "Require(13) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 140 | "start": 1632120212966, 141 | "end": 1632120212967, 142 | "duration": 1, 143 | "pid": 88366, 144 | "index": 17 145 | }, 146 | { 147 | "name": "Require(14) config/config.default.js", 148 | "start": 1632120212968, 149 | "end": 1632120212968, 150 | "duration": 0, 151 | "pid": 88366, 152 | "index": 18 153 | }, 154 | { 155 | "name": "Require(15) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.unittest.js", 156 | "start": 1632120212970, 157 | "end": 1632120212971, 158 | "duration": 1, 159 | "pid": 88366, 160 | "index": 19 161 | }, 162 | { 163 | "name": "Require(16) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.unittest.js", 164 | "start": 1632120212972, 165 | "end": 1632120212972, 166 | "duration": 0, 167 | "pid": 88366, 168 | "index": 20 169 | }, 170 | { 171 | "name": "Load extend/agent.js", 172 | "start": 1632120212973, 173 | "end": 1632120213013, 174 | "duration": 40, 175 | "pid": 88366, 176 | "index": 21 177 | }, 178 | { 179 | "name": "Require(17) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/agent.js", 180 | "start": 1632120212973, 181 | "end": 1632120212974, 182 | "duration": 1, 183 | "pid": 88366, 184 | "index": 22 185 | }, 186 | { 187 | "name": "Require(18) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/app/extend/agent.js", 188 | "start": 1632120212975, 189 | "end": 1632120213008, 190 | "duration": 33, 191 | "pid": 88366, 192 | "index": 23 193 | }, 194 | { 195 | "name": "Require(19) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app/extend/agent.js", 196 | "start": 1632120213008, 197 | "end": 1632120213010, 198 | "duration": 2, 199 | "pid": 88366, 200 | "index": 24 201 | }, 202 | { 203 | "name": "Require(20) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock/app/extend/agent.js", 204 | "start": 1632120213010, 205 | "end": 1632120213012, 206 | "duration": 2, 207 | "pid": 88366, 208 | "index": 25 209 | }, 210 | { 211 | "name": "Load extend/context.js", 212 | "start": 1632120213013, 213 | "end": 1632120213084, 214 | "duration": 71, 215 | "pid": 88366, 216 | "index": 26 217 | }, 218 | { 219 | "name": "Require(21) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/context.js", 220 | "start": 1632120213013, 221 | "end": 1632120213023, 222 | "duration": 10, 223 | "pid": 88366, 224 | "index": 27 225 | }, 226 | { 227 | "name": "Require(22) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/app/extend/context.js", 228 | "start": 1632120213024, 229 | "end": 1632120213026, 230 | "duration": 2, 231 | "pid": 88366, 232 | "index": 28 233 | }, 234 | { 235 | "name": "Require(23) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/app/extend/context.js", 236 | "start": 1632120213027, 237 | "end": 1632120213027, 238 | "duration": 0, 239 | "pid": 88366, 240 | "index": 29 241 | }, 242 | { 243 | "name": "Require(24) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/app/extend/context.js", 244 | "start": 1632120213028, 245 | "end": 1632120213080, 246 | "duration": 52, 247 | "pid": 88366, 248 | "index": 30 249 | }, 250 | { 251 | "name": "Require(25) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/app/extend/context.js", 252 | "start": 1632120213080, 253 | "end": 1632120213082, 254 | "duration": 2, 255 | "pid": 88366, 256 | "index": 31 257 | }, 258 | { 259 | "name": "Require(26) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/context.js", 260 | "start": 1632120213082, 261 | "end": 1632120213083, 262 | "duration": 1, 263 | "pid": 88366, 264 | "index": 32 265 | }, 266 | { 267 | "name": "Load agent.js", 268 | "start": 1632120213084, 269 | "end": 1632120213093, 270 | "duration": 9, 271 | "pid": 88366, 272 | "index": 33 273 | }, 274 | { 275 | "name": "Require(27) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/agent.js", 276 | "start": 1632120213084, 277 | "end": 1632120213085, 278 | "duration": 1, 279 | "pid": 88366, 280 | "index": 34 281 | }, 282 | { 283 | "name": "Require(28) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/agent.js", 284 | "start": 1632120213085, 285 | "end": 1632120213086, 286 | "duration": 1, 287 | "pid": 88366, 288 | "index": 35 289 | }, 290 | { 291 | "name": "Require(29) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/agent.js", 292 | "start": 1632120213086, 293 | "end": 1632120213089, 294 | "duration": 3, 295 | "pid": 88366, 296 | "index": 36 297 | }, 298 | { 299 | "name": "Require(30) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/agent.js", 300 | "start": 1632120213089, 301 | "end": 1632120213091, 302 | "duration": 2, 303 | "pid": 88366, 304 | "index": 37 305 | }, 306 | { 307 | "name": "Require(31) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/agent.js", 308 | "start": 1632120213091, 309 | "end": 1632120213091, 310 | "duration": 0, 311 | "pid": 88366, 312 | "index": 38 313 | }, 314 | { 315 | "name": "Require(32) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/agent.js", 316 | "start": 1632120213092, 317 | "end": 1632120213092, 318 | "duration": 0, 319 | "pid": 88366, 320 | "index": 39 321 | }, 322 | { 323 | "name": "Before Start in /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/lib/init.js:15:14", 324 | "start": 1632120213096, 325 | "end": 1632120213139, 326 | "duration": 43, 327 | "pid": 88366, 328 | "index": 40 329 | }, 330 | { 331 | "name": "Before Start in /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/agent.js:12:9", 332 | "start": 1632120213097, 333 | "end": 1632120213123, 334 | "duration": 26, 335 | "pid": 88366, 336 | "index": 41 337 | } 338 | ] 339 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/run/application_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "session": { 4 | "maxAge": 86400000, 5 | "key": "EGG_SESS", 6 | "httpOnly": true, 7 | "encrypt": true, 8 | "logValue": true, 9 | "overwrite": true, 10 | "signed": true, 11 | "autoCommit": true, 12 | "encode": "", 13 | "decode": "", 14 | "genid": "" 15 | }, 16 | "security": { 17 | "domainWhiteList": [], 18 | "protocolWhiteList": [], 19 | "defaultMiddleware": "csrf,hsts,methodnoallow,noopen,nosniff,csp,xssProtection,xframe,dta", 20 | "csrf": { 21 | "enable": true, 22 | "type": "ctoken", 23 | "ignoreJSON": false, 24 | "useSession": false, 25 | "cookieName": "csrfToken", 26 | "sessionName": "csrfToken", 27 | "headerName": "x-csrf-token", 28 | "bodyName": "_csrf", 29 | "queryName": "_csrf", 30 | "refererWhiteList": [], 31 | "matching": "" 32 | }, 33 | "xframe": { 34 | "enable": true, 35 | "value": "SAMEORIGIN", 36 | "matching": "" 37 | }, 38 | "hsts": { 39 | "enable": false, 40 | "maxAge": 31536000, 41 | "includeSubdomains": false 42 | }, 43 | "dta": { 44 | "enable": true, 45 | "matching": "" 46 | }, 47 | "methodnoallow": { 48 | "enable": true, 49 | "matching": "" 50 | }, 51 | "noopen": { 52 | "enable": true, 53 | "matching": "" 54 | }, 55 | "nosniff": { 56 | "enable": true, 57 | "matching": "" 58 | }, 59 | "referrerPolicy": { 60 | "enable": false, 61 | "value": "no-referrer-when-downgrade" 62 | }, 63 | "xssProtection": { 64 | "enable": true, 65 | "value": "1; mode=block", 66 | "matching": "" 67 | }, 68 | "csp": { 69 | "enable": false, 70 | "policy": {} 71 | }, 72 | "ssrf": { 73 | "ipBlackList": null, 74 | "ipExceptionList": null, 75 | "checkAddress": null 76 | }, 77 | "_protocolWhiteListSet": "" 78 | }, 79 | "helper": { 80 | "shtml": {} 81 | }, 82 | "jsonp": { 83 | "limit": 50, 84 | "callback": ["_callback", "callback"], 85 | "csrf": false 86 | }, 87 | "onerror": { 88 | "errorPageUrl": "", 89 | "appErrorFilter": null, 90 | "templatePath": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/lib/onerror_page.mustache" 91 | }, 92 | "i18n": { 93 | "defaultLocale": "en_US", 94 | "dirs": [ 95 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/locales", 96 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/locales", 97 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/locales", 98 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/locales", 99 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/locales", 100 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/locales", 101 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/locales", 102 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/locales", 103 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/locales", 104 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/locales", 105 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/locales", 106 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/config/locales", 107 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock/config/locales", 108 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/locales", 109 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock/lib/tmp/config/locales", 110 | "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/locales" 111 | ], 112 | "queryField": "locale", 113 | "cookieField": "locale", 114 | "cookieDomain": "", 115 | "cookieMaxAge": "1y", 116 | "functionName": "__" 117 | }, 118 | "watcher": { 119 | "type": "development", 120 | "eventSources": { 121 | "default": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/lib/event-sources/default", 122 | "development": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/lib/event-sources/development" 123 | } 124 | }, 125 | "customLogger": { 126 | "scheduleLogger": { 127 | "consoleLevel": "NONE", 128 | "file": "egg-schedule.log" 129 | } 130 | }, 131 | "schedule": { 132 | "directory": [] 133 | }, 134 | "multipart": { 135 | "mode": "stream", 136 | "autoFields": false, 137 | "defaultCharset": "utf8", 138 | "fieldNameSize": 100, 139 | "fieldSize": 102400, 140 | "fields": 10, 141 | "fileSize": 10485760, 142 | "files": 10, 143 | "fileExtensions": [], 144 | "whitelist": null, 145 | "allowArrayField": false, 146 | "tmpdir": "/var/folders/7c/99zpwkdd5jb44ln7f2d3_nt40000gn/T/egg-multipart-tmp/http-proxy-test", 147 | "cleanSchedule": { 148 | "cron": "0 30 4 * * *", 149 | "disable": false 150 | } 151 | }, 152 | "logrotator": { 153 | "filesRotateByHour": null, 154 | "hourDelimiter": "-", 155 | "filesRotateBySize": null, 156 | "maxFileSize": 52428800, 157 | "maxFiles": 10, 158 | "rotateDuration": 60000, 159 | "maxDays": 31 160 | }, 161 | "static": { 162 | "prefix": "/public/", 163 | "dir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/app/public", 164 | "dynamic": true, 165 | "preload": false, 166 | "buffer": false, 167 | "maxFiles": 1000 168 | }, 169 | "view": { 170 | "root": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/app/view", 171 | "cache": true, 172 | "defaultExtension": ".html", 173 | "defaultViewEngine": "", 174 | "mapping": {} 175 | }, 176 | "httpProxyPlus": { 177 | "/proxy1": "http://localhost:3000", 178 | "/api/proxy2": { 179 | "target": "http://localhost:3001", 180 | "pathRewrite": { 181 | "^/api": "" 182 | } 183 | } 184 | }, 185 | "env": "unittest", 186 | "name": "http-proxy-test", 187 | "keys": "", 188 | "cookies": {}, 189 | "proxy": false, 190 | "maxIpsCount": 0, 191 | "maxProxyCount": 0, 192 | "protocolHeaders": "x-forwarded-proto", 193 | "ipHeaders": "x-forwarded-for", 194 | "hostHeaders": "", 195 | "pkg": { 196 | "name": "http-proxy-test", 197 | "version": "0.0.1" 198 | }, 199 | "baseDir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test", 200 | "HOME": "/Users/saqqdy", 201 | "rundir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/run", 202 | "dump": { 203 | "ignore": "" 204 | }, 205 | "confusedConfigurations": { 206 | "bodyparser": "bodyParser", 207 | "notFound": "notfound", 208 | "sitefile": "siteFile", 209 | "middlewares": "middleware", 210 | "httpClient": "httpclient" 211 | }, 212 | "notfound": { 213 | "pageUrl": "" 214 | }, 215 | "siteFile": { 216 | "/favicon.ico": "" 217 | }, 218 | "bodyParser": { 219 | "enable": true, 220 | "encoding": "utf8", 221 | "formLimit": "1mb", 222 | "jsonLimit": "1mb", 223 | "textLimit": "1mb", 224 | "strict": true, 225 | "queryString": { 226 | "arrayLimit": 100, 227 | "depth": 5, 228 | "parameterLimit": 1000 229 | }, 230 | "returnRawBody": true 231 | }, 232 | "logger": { 233 | "dir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/logs/http-proxy-test", 234 | "encoding": "utf8", 235 | "env": "unittest", 236 | "level": "INFO", 237 | "consoleLevel": "WARN", 238 | "disableConsoleAfterReady": false, 239 | "outputJSON": false, 240 | "buffer": false, 241 | "appLogName": "http-proxy-test-web.log", 242 | "coreLogName": "egg-web.log", 243 | "agentLogName": "egg-agent.log", 244 | "errorLogName": "common-error.log", 245 | "coreLogger": {}, 246 | "allowDebugAtProd": false, 247 | "type": "application" 248 | }, 249 | "httpclient": { 250 | "enableDNSCache": false, 251 | "dnsCacheLookupInterval": 10000, 252 | "dnsCacheMaxLength": 1000, 253 | "request": { 254 | "timeout": 5000 255 | }, 256 | "httpAgent": { 257 | "keepAlive": true, 258 | "freeSocketTimeout": 4000, 259 | "maxSockets": 9007199254740991, 260 | "maxFreeSockets": 256 261 | }, 262 | "httpsAgent": { 263 | "keepAlive": true, 264 | "freeSocketTimeout": 4000, 265 | "maxSockets": 9007199254740991, 266 | "maxFreeSockets": 256 267 | } 268 | }, 269 | "meta": { 270 | "enable": true, 271 | "logging": false 272 | }, 273 | "coreMiddleware": [ 274 | "httpProxyPlus", 275 | "meta", 276 | "siteFile", 277 | "notfound", 278 | "static", 279 | "bodyParser", 280 | "overrideMethod", 281 | "session", 282 | "clusterAppMock", 283 | "securities", 284 | "i18n" 285 | ], 286 | "workerStartTimeout": 600000, 287 | "serverTimeout": null, 288 | "cluster": { 289 | "listen": { 290 | "path": "", 291 | "port": 7001, 292 | "hostname": "" 293 | } 294 | }, 295 | "clusterClient": { 296 | "maxWaitTime": 60000, 297 | "responseTimeout": 60000 298 | }, 299 | "onClientError": null, 300 | "coreMiddlewares": "~config~coreMiddleware", 301 | "appMiddlewares": [], 302 | "appMiddleware": "~config~appMiddlewares", 303 | "multipartParseOptions": { 304 | "autoFields": false, 305 | "defCharset": "utf8", 306 | "limits": { 307 | "fieldNameSize": 100, 308 | "fieldSize": 102400, 309 | "fields": 10, 310 | "fileSize": 10485760, 311 | "files": 10 312 | }, 313 | "checkFile": "" 314 | } 315 | }, 316 | "plugins": { 317 | "onerror": { 318 | "enable": true, 319 | "package": "egg-onerror", 320 | "name": "onerror", 321 | "dependencies": [], 322 | "optionalDependencies": ["jsonp"], 323 | "env": [], 324 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 325 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror", 326 | "version": "2.1.0" 327 | }, 328 | "session": { 329 | "enable": true, 330 | "package": "egg-session", 331 | "name": "session", 332 | "dependencies": [], 333 | "optionalDependencies": [], 334 | "env": [], 335 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 336 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session", 337 | "version": "3.3.0" 338 | }, 339 | "i18n": { 340 | "enable": true, 341 | "package": "egg-i18n", 342 | "name": "i18n", 343 | "dependencies": [], 344 | "optionalDependencies": [], 345 | "env": [], 346 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 347 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n", 348 | "version": "2.1.1" 349 | }, 350 | "watcher": { 351 | "enable": true, 352 | "package": "egg-watcher", 353 | "name": "watcher", 354 | "dependencies": [], 355 | "optionalDependencies": [], 356 | "env": [], 357 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 358 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher", 359 | "version": "3.1.1" 360 | }, 361 | "multipart": { 362 | "enable": true, 363 | "package": "egg-multipart", 364 | "name": "multipart", 365 | "dependencies": [], 366 | "optionalDependencies": ["schedule"], 367 | "env": [], 368 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 369 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart", 370 | "version": "2.13.1" 371 | }, 372 | "security": { 373 | "enable": true, 374 | "package": "egg-security", 375 | "name": "security", 376 | "dependencies": [], 377 | "optionalDependencies": ["session"], 378 | "env": [], 379 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 380 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security", 381 | "version": "2.9.0" 382 | }, 383 | "development": { 384 | "enable": false, 385 | "package": "egg-development", 386 | "name": "development", 387 | "dependencies": ["watcher"], 388 | "optionalDependencies": [], 389 | "env": ["local"], 390 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 391 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-development", 392 | "version": "2.7.0" 393 | }, 394 | "logrotator": { 395 | "enable": true, 396 | "package": "egg-logrotator", 397 | "name": "logrotator", 398 | "dependencies": ["schedule"], 399 | "optionalDependencies": [], 400 | "env": [], 401 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 402 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator", 403 | "version": "3.1.0" 404 | }, 405 | "schedule": { 406 | "enable": true, 407 | "package": "egg-schedule", 408 | "name": "schedule", 409 | "dependencies": [], 410 | "optionalDependencies": [], 411 | "env": [], 412 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 413 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule", 414 | "version": "3.6.6" 415 | }, 416 | "static": { 417 | "enable": true, 418 | "package": "egg-static", 419 | "name": "static", 420 | "dependencies": [], 421 | "optionalDependencies": [], 422 | "env": [], 423 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 424 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static", 425 | "version": "2.2.0" 426 | }, 427 | "jsonp": { 428 | "enable": true, 429 | "package": "egg-jsonp", 430 | "name": "jsonp", 431 | "dependencies": [], 432 | "optionalDependencies": ["security"], 433 | "env": [], 434 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 435 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp", 436 | "version": "2.0.0" 437 | }, 438 | "view": { 439 | "enable": true, 440 | "package": "egg-view", 441 | "name": "view", 442 | "dependencies": [], 443 | "optionalDependencies": [], 444 | "env": [], 445 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/plugin.js", 446 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view", 447 | "version": "2.1.3" 448 | }, 449 | "httpProxyPlus": { 450 | "enable": true, 451 | "name": "httpProxyPlus", 452 | "dependencies": [], 453 | "optionalDependencies": [], 454 | "env": [], 455 | "from": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/plugin.js", 456 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus", 457 | "version": "1.1.0" 458 | }, 459 | "egg-mock": { 460 | "enable": true, 461 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock", 462 | "name": "egg-mock", 463 | "dependencies": [], 464 | "optionalDependencies": [], 465 | "env": [], 466 | "version": "3.26.0" 467 | } 468 | } 469 | } 470 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/run/application_config_meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "keys": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/config.default.js", 3 | "httpProxyPlus": { 4 | "/proxy1": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/config.default.js", 5 | "/api/proxy2": { 6 | "target": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/config.default.js", 7 | "pathRewrite": { 8 | "^/api": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/test/fixtures/apps/http-proxy-test/config/config.default.js" 9 | } 10 | } 11 | }, 12 | "session": { 13 | "maxAge": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 14 | "key": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 15 | "httpOnly": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 16 | "encrypt": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 17 | "logValue": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js" 18 | }, 19 | "security": { 20 | "domainWhiteList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 21 | "protocolWhiteList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 22 | "defaultMiddleware": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 23 | "csrf": { 24 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 25 | "type": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 26 | "ignoreJSON": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 27 | "useSession": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 28 | "cookieName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 29 | "sessionName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 30 | "headerName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 31 | "bodyName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 32 | "queryName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 33 | "refererWhiteList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 34 | }, 35 | "xframe": { 36 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 37 | "value": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 38 | }, 39 | "hsts": { 40 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 41 | "maxAge": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 42 | "includeSubdomains": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 43 | }, 44 | "dta": { 45 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 46 | }, 47 | "methodnoallow": { 48 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 49 | }, 50 | "noopen": { 51 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 52 | }, 53 | "nosniff": { 54 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 55 | }, 56 | "referrerPolicy": { 57 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 58 | "value": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 59 | }, 60 | "xssProtection": { 61 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 62 | "value": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 63 | }, 64 | "csp": { 65 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 66 | "policy": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 67 | }, 68 | "ssrf": { 69 | "ipBlackList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 70 | "ipExceptionList": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 71 | "checkAddress": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 72 | } 73 | }, 74 | "helper": { 75 | "shtml": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js" 76 | }, 77 | "jsonp": { 78 | "limit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js", 79 | "callback": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js", 80 | "csrf": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js" 81 | }, 82 | "onerror": { 83 | "errorPageUrl": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js", 84 | "appErrorFilter": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js", 85 | "templatePath": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js" 86 | }, 87 | "i18n": { 88 | "defaultLocale": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 89 | "dirs": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 90 | "queryField": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 91 | "cookieField": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 92 | "cookieDomain": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 93 | "cookieMaxAge": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js" 94 | }, 95 | "watcher": { 96 | "type": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.unittest.js", 97 | "eventSources": { 98 | "default": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.default.js", 99 | "development": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.default.js" 100 | } 101 | }, 102 | "customLogger": { 103 | "scheduleLogger": { 104 | "consoleLevel": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js", 105 | "file": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js" 106 | } 107 | }, 108 | "schedule": { 109 | "directory": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js" 110 | }, 111 | "multipart": { 112 | "mode": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 113 | "autoFields": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 114 | "defaultCharset": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 115 | "fieldNameSize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 116 | "fieldSize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 117 | "fields": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 118 | "fileSize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 119 | "files": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 120 | "fileExtensions": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 121 | "whitelist": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 122 | "allowArrayField": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 123 | "tmpdir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 124 | "cleanSchedule": { 125 | "cron": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 126 | "disable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js" 127 | } 128 | }, 129 | "logrotator": { 130 | "filesRotateByHour": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 131 | "hourDelimiter": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 132 | "filesRotateBySize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 133 | "maxFileSize": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 134 | "maxFiles": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 135 | "rotateDuration": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 136 | "maxDays": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js" 137 | }, 138 | "static": { 139 | "prefix": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 140 | "dir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 141 | "dynamic": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 142 | "preload": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 143 | "buffer": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 144 | "maxFiles": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js" 145 | }, 146 | "view": { 147 | "root": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 148 | "cache": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 149 | "defaultExtension": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 150 | "defaultViewEngine": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 151 | "mapping": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js" 152 | }, 153 | "env": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 154 | "name": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 155 | "cookies": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 156 | "proxy": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 157 | "maxIpsCount": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 158 | "maxProxyCount": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 159 | "protocolHeaders": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 160 | "ipHeaders": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 161 | "hostHeaders": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 162 | "pkg": { 163 | "name": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 164 | "version": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 165 | }, 166 | "baseDir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 167 | "HOME": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 168 | "rundir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 169 | "dump": { 170 | "ignore": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 171 | }, 172 | "confusedConfigurations": { 173 | "bodyparser": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 174 | "notFound": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 175 | "sitefile": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 176 | "middlewares": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 177 | "httpClient": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 178 | }, 179 | "notfound": { 180 | "pageUrl": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 181 | }, 182 | "siteFile": { 183 | "/favicon.ico": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 184 | }, 185 | "bodyParser": { 186 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 187 | "encoding": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 188 | "formLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 189 | "jsonLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 190 | "textLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 191 | "strict": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 192 | "queryString": { 193 | "arrayLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 194 | "depth": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 195 | "parameterLimit": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 196 | }, 197 | "onerror": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 198 | }, 199 | "logger": { 200 | "dir": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 201 | "encoding": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 202 | "env": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 203 | "level": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 204 | "consoleLevel": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.unittest.js", 205 | "disableConsoleAfterReady": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 206 | "outputJSON": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 207 | "buffer": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.unittest.js", 208 | "appLogName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 209 | "coreLogName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 210 | "agentLogName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 211 | "errorLogName": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 212 | "coreLogger": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 213 | "allowDebugAtProd": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 214 | }, 215 | "httpclient": { 216 | "enableDNSCache": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 217 | "dnsCacheLookupInterval": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 218 | "dnsCacheMaxLength": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 219 | "request": { 220 | "timeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 221 | }, 222 | "httpAgent": { 223 | "keepAlive": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 224 | "freeSocketTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 225 | "maxSockets": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 226 | "maxFreeSockets": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 227 | }, 228 | "httpsAgent": { 229 | "keepAlive": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 230 | "freeSocketTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 231 | "maxSockets": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 232 | "maxFreeSockets": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 233 | } 234 | }, 235 | "meta": { 236 | "enable": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 237 | "logging": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 238 | }, 239 | "coreMiddleware": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 240 | "workerStartTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 241 | "serverTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 242 | "cluster": { 243 | "listen": { 244 | "path": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 245 | "port": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 246 | "hostname": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 247 | } 248 | }, 249 | "clusterClient": { 250 | "maxWaitTime": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 251 | "responseTimeout": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 252 | }, 253 | "onClientError": "/Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js" 254 | } 255 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/run/application_timing_84615.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Process Start", 4 | "start": 1632118570934, 5 | "end": 1632118572333, 6 | "duration": 1399, 7 | "pid": 84615, 8 | "index": 0 9 | }, 10 | { 11 | "name": "Application Start", 12 | "start": 1632118572333, 13 | "end": 1632118572683, 14 | "duration": 350, 15 | "pid": 84615, 16 | "index": 1 17 | }, 18 | { 19 | "name": "Load Plugin", 20 | "start": 1632118572334, 21 | "end": 1632118572337, 22 | "duration": 3, 23 | "pid": 84615, 24 | "index": 2 25 | }, 26 | { 27 | "name": "Load Config", 28 | "start": 1632118572337, 29 | "end": 1632118572340, 30 | "duration": 3, 31 | "pid": 84615, 32 | "index": 3 33 | }, 34 | { 35 | "name": "Require(0) config/config.default.js", 36 | "start": 1632118572337, 37 | "end": 1632118572337, 38 | "duration": 0, 39 | "pid": 84615, 40 | "index": 4 41 | }, 42 | { 43 | "name": "Require(1) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 44 | "start": 1632118572337, 45 | "end": 1632118572337, 46 | "duration": 0, 47 | "pid": 84615, 48 | "index": 5 49 | }, 50 | { 51 | "name": "Require(2) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 52 | "start": 1632118572337, 53 | "end": 1632118572337, 54 | "duration": 0, 55 | "pid": 84615, 56 | "index": 6 57 | }, 58 | { 59 | "name": "Require(3) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js", 60 | "start": 1632118572338, 61 | "end": 1632118572338, 62 | "duration": 0, 63 | "pid": 84615, 64 | "index": 7 65 | }, 66 | { 67 | "name": "Require(4) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js", 68 | "start": 1632118572338, 69 | "end": 1632118572338, 70 | "duration": 0, 71 | "pid": 84615, 72 | "index": 8 73 | }, 74 | { 75 | "name": "Require(5) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 76 | "start": 1632118572338, 77 | "end": 1632118572338, 78 | "duration": 0, 79 | "pid": 84615, 80 | "index": 9 81 | }, 82 | { 83 | "name": "Require(6) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.default.js", 84 | "start": 1632118572338, 85 | "end": 1632118572338, 86 | "duration": 0, 87 | "pid": 84615, 88 | "index": 10 89 | }, 90 | { 91 | "name": "Require(7) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js", 92 | "start": 1632118572338, 93 | "end": 1632118572338, 94 | "duration": 0, 95 | "pid": 84615, 96 | "index": 11 97 | }, 98 | { 99 | "name": "Require(8) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 100 | "start": 1632118572338, 101 | "end": 1632118572338, 102 | "duration": 0, 103 | "pid": 84615, 104 | "index": 12 105 | }, 106 | { 107 | "name": "Require(9) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 108 | "start": 1632118572338, 109 | "end": 1632118572338, 110 | "duration": 0, 111 | "pid": 84615, 112 | "index": 13 113 | }, 114 | { 115 | "name": "Require(10) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 116 | "start": 1632118572339, 117 | "end": 1632118572339, 118 | "duration": 0, 119 | "pid": 84615, 120 | "index": 14 121 | }, 122 | { 123 | "name": "Require(11) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 124 | "start": 1632118572339, 125 | "end": 1632118572339, 126 | "duration": 0, 127 | "pid": 84615, 128 | "index": 15 129 | }, 130 | { 131 | "name": "Require(12) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/config/config.default.js", 132 | "start": 1632118572339, 133 | "end": 1632118572339, 134 | "duration": 0, 135 | "pid": 84615, 136 | "index": 16 137 | }, 138 | { 139 | "name": "Require(13) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 140 | "start": 1632118572339, 141 | "end": 1632118572339, 142 | "duration": 0, 143 | "pid": 84615, 144 | "index": 17 145 | }, 146 | { 147 | "name": "Require(14) config/config.default.js", 148 | "start": 1632118572339, 149 | "end": 1632118572339, 150 | "duration": 0, 151 | "pid": 84615, 152 | "index": 18 153 | }, 154 | { 155 | "name": "Require(15) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.unittest.js", 156 | "start": 1632118572340, 157 | "end": 1632118572340, 158 | "duration": 0, 159 | "pid": 84615, 160 | "index": 19 161 | }, 162 | { 163 | "name": "Require(16) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.unittest.js", 164 | "start": 1632118572340, 165 | "end": 1632118572340, 166 | "duration": 0, 167 | "pid": 84615, 168 | "index": 20 169 | }, 170 | { 171 | "name": "Load extend/application.js", 172 | "start": 1632118572340, 173 | "end": 1632118572356, 174 | "duration": 16, 175 | "pid": 84615, 176 | "index": 21 177 | }, 178 | { 179 | "name": "Require(17) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/app/extend/application.js", 180 | "start": 1632118572341, 181 | "end": 1632118572342, 182 | "duration": 1, 183 | "pid": 84615, 184 | "index": 22 185 | }, 186 | { 187 | "name": "Require(18) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/application.js", 188 | "start": 1632118572342, 189 | "end": 1632118572342, 190 | "duration": 0, 191 | "pid": 84615, 192 | "index": 23 193 | }, 194 | { 195 | "name": "Require(19) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/app/extend/application.js", 196 | "start": 1632118572343, 197 | "end": 1632118572343, 198 | "duration": 0, 199 | "pid": 84615, 200 | "index": 24 201 | }, 202 | { 203 | "name": "Require(20) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app/extend/application.js", 204 | "start": 1632118572344, 205 | "end": 1632118572344, 206 | "duration": 0, 207 | "pid": 84615, 208 | "index": 25 209 | }, 210 | { 211 | "name": "Require(21) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/app/extend/application.js", 212 | "start": 1632118572345, 213 | "end": 1632118572351, 214 | "duration": 6, 215 | "pid": 84615, 216 | "index": 26 217 | }, 218 | { 219 | "name": "Require(22) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock/app/extend/application.js", 220 | "start": 1632118572351, 221 | "end": 1632118572355, 222 | "duration": 4, 223 | "pid": 84615, 224 | "index": 27 225 | }, 226 | { 227 | "name": "Load extend/request.js", 228 | "start": 1632118572356, 229 | "end": 1632118572359, 230 | "duration": 3, 231 | "pid": 84615, 232 | "index": 28 233 | }, 234 | { 235 | "name": "Require(23) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/request.js", 236 | "start": 1632118572357, 237 | "end": 1632118572358, 238 | "duration": 1, 239 | "pid": 84615, 240 | "index": 29 241 | }, 242 | { 243 | "name": "Load extend/response.js", 244 | "start": 1632118572359, 245 | "end": 1632118572362, 246 | "duration": 3, 247 | "pid": 84615, 248 | "index": 30 249 | }, 250 | { 251 | "name": "Require(24) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/response.js", 252 | "start": 1632118572359, 253 | "end": 1632118572361, 254 | "duration": 2, 255 | "pid": 84615, 256 | "index": 31 257 | }, 258 | { 259 | "name": "Load extend/context.js", 260 | "start": 1632118572362, 261 | "end": 1632118572363, 262 | "duration": 1, 263 | "pid": 84615, 264 | "index": 32 265 | }, 266 | { 267 | "name": "Require(25) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/context.js", 268 | "start": 1632118572362, 269 | "end": 1632118572362, 270 | "duration": 0, 271 | "pid": 84615, 272 | "index": 33 273 | }, 274 | { 275 | "name": "Require(26) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/app/extend/context.js", 276 | "start": 1632118572362, 277 | "end": 1632118572362, 278 | "duration": 0, 279 | "pid": 84615, 280 | "index": 34 281 | }, 282 | { 283 | "name": "Require(27) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/app/extend/context.js", 284 | "start": 1632118572362, 285 | "end": 1632118572362, 286 | "duration": 0, 287 | "pid": 84615, 288 | "index": 35 289 | }, 290 | { 291 | "name": "Require(28) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/app/extend/context.js", 292 | "start": 1632118572362, 293 | "end": 1632118572362, 294 | "duration": 0, 295 | "pid": 84615, 296 | "index": 36 297 | }, 298 | { 299 | "name": "Require(29) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/app/extend/context.js", 300 | "start": 1632118572362, 301 | "end": 1632118572362, 302 | "duration": 0, 303 | "pid": 84615, 304 | "index": 37 305 | }, 306 | { 307 | "name": "Require(30) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/context.js", 308 | "start": 1632118572362, 309 | "end": 1632118572362, 310 | "duration": 0, 311 | "pid": 84615, 312 | "index": 38 313 | }, 314 | { 315 | "name": "Load extend/helper.js", 316 | "start": 1632118572363, 317 | "end": 1632118572383, 318 | "duration": 20, 319 | "pid": 84615, 320 | "index": 39 321 | }, 322 | { 323 | "name": "Require(31) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/helper.js", 324 | "start": 1632118572363, 325 | "end": 1632118572381, 326 | "duration": 18, 327 | "pid": 84615, 328 | "index": 40 329 | }, 330 | { 331 | "name": "Require(32) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/helper.js", 332 | "start": 1632118572382, 333 | "end": 1632118572382, 334 | "duration": 0, 335 | "pid": 84615, 336 | "index": 41 337 | }, 338 | { 339 | "name": "Load app.js", 340 | "start": 1632118572383, 341 | "end": 1632118572425, 342 | "duration": 42, 343 | "pid": 84615, 344 | "index": 42 345 | }, 346 | { 347 | "name": "Require(33) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/app.js", 348 | "start": 1632118572383, 349 | "end": 1632118572384, 350 | "duration": 1, 351 | "pid": 84615, 352 | "index": 43 353 | }, 354 | { 355 | "name": "Require(34) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app.js", 356 | "start": 1632118572384, 357 | "end": 1632118572386, 358 | "duration": 2, 359 | "pid": 84615, 360 | "index": 44 361 | }, 362 | { 363 | "name": "Require(35) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/app.js", 364 | "start": 1632118572386, 365 | "end": 1632118572392, 366 | "duration": 6, 367 | "pid": 84615, 368 | "index": 45 369 | }, 370 | { 371 | "name": "Require(36) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/app.js", 372 | "start": 1632118572392, 373 | "end": 1632118572408, 374 | "duration": 16, 375 | "pid": 84615, 376 | "index": 46 377 | }, 378 | { 379 | "name": "Require(37) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/app.js", 380 | "start": 1632118572408, 381 | "end": 1632118572409, 382 | "duration": 1, 383 | "pid": 84615, 384 | "index": 47 385 | }, 386 | { 387 | "name": "Require(38) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/app.js", 388 | "start": 1632118572409, 389 | "end": 1632118572410, 390 | "duration": 1, 391 | "pid": 84615, 392 | "index": 48 393 | }, 394 | { 395 | "name": "Require(39) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/app.js", 396 | "start": 1632118572410, 397 | "end": 1632118572411, 398 | "duration": 1, 399 | "pid": 84615, 400 | "index": 49 401 | }, 402 | { 403 | "name": "Require(40) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app.js", 404 | "start": 1632118572411, 405 | "end": 1632118572413, 406 | "duration": 2, 407 | "pid": 84615, 408 | "index": 50 409 | }, 410 | { 411 | "name": "Require(41) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/app.js", 412 | "start": 1632118572413, 413 | "end": 1632118572414, 414 | "duration": 1, 415 | "pid": 84615, 416 | "index": 51 417 | }, 418 | { 419 | "name": "Require(42) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/app.js", 420 | "start": 1632118572414, 421 | "end": 1632118572424, 422 | "duration": 10, 423 | "pid": 84615, 424 | "index": 52 425 | }, 426 | { 427 | "name": "Require(43) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock/app.js", 428 | "start": 1632118572424, 429 | "end": 1632118572425, 430 | "duration": 1, 431 | "pid": 84615, 432 | "index": 53 433 | }, 434 | { 435 | "name": "Before Start in /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/lib/init.js:15:14", 436 | "start": 1632118572428, 437 | "end": 1632118572682, 438 | "duration": 254, 439 | "pid": 84615, 440 | "index": 54 441 | }, 442 | { 443 | "name": "Load Service", 444 | "start": 1632118572433, 445 | "end": 1632118572436, 446 | "duration": 3, 447 | "pid": 84615, 448 | "index": 55 449 | }, 450 | { 451 | "name": "Load \"service\" to Context", 452 | "start": 1632118572434, 453 | "end": 1632118572436, 454 | "duration": 2, 455 | "pid": 84615, 456 | "index": 56 457 | }, 458 | { 459 | "name": "Load Middleware", 460 | "start": 1632118572436, 461 | "end": 1632118572663, 462 | "duration": 227, 463 | "pid": 84615, 464 | "index": 57 465 | }, 466 | { 467 | "name": "Load \"middlewares\" to Application", 468 | "start": 1632118572437, 469 | "end": 1632118572649, 470 | "duration": 212, 471 | "pid": 84615, 472 | "index": 58 473 | }, 474 | { 475 | "name": "Load Controller", 476 | "start": 1632118572664, 477 | "end": 1632118572668, 478 | "duration": 4, 479 | "pid": 84615, 480 | "index": 59 481 | }, 482 | { 483 | "name": "Load \"controller\" to Application", 484 | "start": 1632118572664, 485 | "end": 1632118572668, 486 | "duration": 4, 487 | "pid": 84615, 488 | "index": 60 489 | }, 490 | { 491 | "name": "Load Router", 492 | "start": 1632118572668, 493 | "end": 1632118572672, 494 | "duration": 4, 495 | "pid": 84615, 496 | "index": 61 497 | }, 498 | { 499 | "name": "Require(44) app/router.js", 500 | "start": 1632118572668, 501 | "end": 1632118572671, 502 | "duration": 3, 503 | "pid": 84615, 504 | "index": 62 505 | }, 506 | { 507 | "name": "Before Start in /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-core/lib/egg.js:303:10", 508 | "start": 1632118572671, 509 | "end": 1632118572676, 510 | "duration": 5, 511 | "pid": 84615, 512 | "index": 63 513 | } 514 | ] 515 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/run/application_timing_88366.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "Process Start", 4 | "start": 1632120211454, 5 | "end": 1632120213143, 6 | "duration": 1689, 7 | "pid": 88366, 8 | "index": 0 9 | }, 10 | { 11 | "name": "Application Start", 12 | "start": 1632120213143, 13 | "end": 1632120213511, 14 | "duration": 368, 15 | "pid": 88366, 16 | "index": 1 17 | }, 18 | { 19 | "name": "Load Plugin", 20 | "start": 1632120213144, 21 | "end": 1632120213146, 22 | "duration": 2, 23 | "pid": 88366, 24 | "index": 2 25 | }, 26 | { 27 | "name": "Load Config", 28 | "start": 1632120213146, 29 | "end": 1632120213148, 30 | "duration": 2, 31 | "pid": 88366, 32 | "index": 3 33 | }, 34 | { 35 | "name": "Require(0) config/config.default.js", 36 | "start": 1632120213146, 37 | "end": 1632120213146, 38 | "duration": 0, 39 | "pid": 88366, 40 | "index": 4 41 | }, 42 | { 43 | "name": "Require(1) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/config/config.default.js", 44 | "start": 1632120213146, 45 | "end": 1632120213146, 46 | "duration": 0, 47 | "pid": 88366, 48 | "index": 5 49 | }, 50 | { 51 | "name": "Require(2) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/config/config.default.js", 52 | "start": 1632120213146, 53 | "end": 1632120213146, 54 | "duration": 0, 55 | "pid": 88366, 56 | "index": 6 57 | }, 58 | { 59 | "name": "Require(3) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/config/config.default.js", 60 | "start": 1632120213146, 61 | "end": 1632120213146, 62 | "duration": 0, 63 | "pid": 88366, 64 | "index": 7 65 | }, 66 | { 67 | "name": "Require(4) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/config/config.default.js", 68 | "start": 1632120213146, 69 | "end": 1632120213146, 70 | "duration": 0, 71 | "pid": 88366, 72 | "index": 8 73 | }, 74 | { 75 | "name": "Require(5) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/config/config.default.js", 76 | "start": 1632120213146, 77 | "end": 1632120213146, 78 | "duration": 0, 79 | "pid": 88366, 80 | "index": 9 81 | }, 82 | { 83 | "name": "Require(6) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.default.js", 84 | "start": 1632120213146, 85 | "end": 1632120213146, 86 | "duration": 0, 87 | "pid": 88366, 88 | "index": 10 89 | }, 90 | { 91 | "name": "Require(7) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/config/config.default.js", 92 | "start": 1632120213146, 93 | "end": 1632120213146, 94 | "duration": 0, 95 | "pid": 88366, 96 | "index": 11 97 | }, 98 | { 99 | "name": "Require(8) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/config/config.default.js", 100 | "start": 1632120213146, 101 | "end": 1632120213146, 102 | "duration": 0, 103 | "pid": 88366, 104 | "index": 12 105 | }, 106 | { 107 | "name": "Require(9) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/config/config.default.js", 108 | "start": 1632120213146, 109 | "end": 1632120213146, 110 | "duration": 0, 111 | "pid": 88366, 112 | "index": 13 113 | }, 114 | { 115 | "name": "Require(10) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/config/config.default.js", 116 | "start": 1632120213146, 117 | "end": 1632120213146, 118 | "duration": 0, 119 | "pid": 88366, 120 | "index": 14 121 | }, 122 | { 123 | "name": "Require(11) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/config/config.default.js", 124 | "start": 1632120213146, 125 | "end": 1632120213146, 126 | "duration": 0, 127 | "pid": 88366, 128 | "index": 15 129 | }, 130 | { 131 | "name": "Require(12) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/config/config.default.js", 132 | "start": 1632120213146, 133 | "end": 1632120213146, 134 | "duration": 0, 135 | "pid": 88366, 136 | "index": 16 137 | }, 138 | { 139 | "name": "Require(13) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.default.js", 140 | "start": 1632120213147, 141 | "end": 1632120213147, 142 | "duration": 0, 143 | "pid": 88366, 144 | "index": 17 145 | }, 146 | { 147 | "name": "Require(14) config/config.default.js", 148 | "start": 1632120213147, 149 | "end": 1632120213147, 150 | "duration": 0, 151 | "pid": 88366, 152 | "index": 18 153 | }, 154 | { 155 | "name": "Require(15) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/config/config.unittest.js", 156 | "start": 1632120213147, 157 | "end": 1632120213147, 158 | "duration": 0, 159 | "pid": 88366, 160 | "index": 19 161 | }, 162 | { 163 | "name": "Require(16) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/config/config.unittest.js", 164 | "start": 1632120213148, 165 | "end": 1632120213148, 166 | "duration": 0, 167 | "pid": 88366, 168 | "index": 20 169 | }, 170 | { 171 | "name": "Load extend/application.js", 172 | "start": 1632120213148, 173 | "end": 1632120213156, 174 | "duration": 8, 175 | "pid": 88366, 176 | "index": 21 177 | }, 178 | { 179 | "name": "Require(17) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/app/extend/application.js", 180 | "start": 1632120213148, 181 | "end": 1632120213149, 182 | "duration": 1, 183 | "pid": 88366, 184 | "index": 22 185 | }, 186 | { 187 | "name": "Require(18) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/application.js", 188 | "start": 1632120213149, 189 | "end": 1632120213150, 190 | "duration": 1, 191 | "pid": 88366, 192 | "index": 23 193 | }, 194 | { 195 | "name": "Require(19) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/app/extend/application.js", 196 | "start": 1632120213150, 197 | "end": 1632120213151, 198 | "duration": 1, 199 | "pid": 88366, 200 | "index": 24 201 | }, 202 | { 203 | "name": "Require(20) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app/extend/application.js", 204 | "start": 1632120213151, 205 | "end": 1632120213151, 206 | "duration": 0, 207 | "pid": 88366, 208 | "index": 25 209 | }, 210 | { 211 | "name": "Require(21) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/app/extend/application.js", 212 | "start": 1632120213152, 213 | "end": 1632120213154, 214 | "duration": 2, 215 | "pid": 88366, 216 | "index": 26 217 | }, 218 | { 219 | "name": "Require(22) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock/app/extend/application.js", 220 | "start": 1632120213154, 221 | "end": 1632120213155, 222 | "duration": 1, 223 | "pid": 88366, 224 | "index": 27 225 | }, 226 | { 227 | "name": "Load extend/request.js", 228 | "start": 1632120213156, 229 | "end": 1632120213159, 230 | "duration": 3, 231 | "pid": 88366, 232 | "index": 28 233 | }, 234 | { 235 | "name": "Require(23) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/request.js", 236 | "start": 1632120213157, 237 | "end": 1632120213158, 238 | "duration": 1, 239 | "pid": 88366, 240 | "index": 29 241 | }, 242 | { 243 | "name": "Load extend/response.js", 244 | "start": 1632120213159, 245 | "end": 1632120213162, 246 | "duration": 3, 247 | "pid": 88366, 248 | "index": 30 249 | }, 250 | { 251 | "name": "Require(24) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/response.js", 252 | "start": 1632120213160, 253 | "end": 1632120213161, 254 | "duration": 1, 255 | "pid": 88366, 256 | "index": 31 257 | }, 258 | { 259 | "name": "Load extend/context.js", 260 | "start": 1632120213162, 261 | "end": 1632120213163, 262 | "duration": 1, 263 | "pid": 88366, 264 | "index": 32 265 | }, 266 | { 267 | "name": "Require(25) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/context.js", 268 | "start": 1632120213162, 269 | "end": 1632120213162, 270 | "duration": 0, 271 | "pid": 88366, 272 | "index": 33 273 | }, 274 | { 275 | "name": "Require(26) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-jsonp/app/extend/context.js", 276 | "start": 1632120213162, 277 | "end": 1632120213162, 278 | "duration": 0, 279 | "pid": 88366, 280 | "index": 34 281 | }, 282 | { 283 | "name": "Require(27) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/app/extend/context.js", 284 | "start": 1632120213162, 285 | "end": 1632120213162, 286 | "duration": 0, 287 | "pid": 88366, 288 | "index": 35 289 | }, 290 | { 291 | "name": "Require(28) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/app/extend/context.js", 292 | "start": 1632120213162, 293 | "end": 1632120213162, 294 | "duration": 0, 295 | "pid": 88366, 296 | "index": 36 297 | }, 298 | { 299 | "name": "Require(29) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-view/app/extend/context.js", 300 | "start": 1632120213162, 301 | "end": 1632120213162, 302 | "duration": 0, 303 | "pid": 88366, 304 | "index": 37 305 | }, 306 | { 307 | "name": "Require(30) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/context.js", 308 | "start": 1632120213163, 309 | "end": 1632120213163, 310 | "duration": 0, 311 | "pid": 88366, 312 | "index": 38 313 | }, 314 | { 315 | "name": "Load extend/helper.js", 316 | "start": 1632120213163, 317 | "end": 1632120213184, 318 | "duration": 21, 319 | "pid": 88366, 320 | "index": 39 321 | }, 322 | { 323 | "name": "Require(31) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app/extend/helper.js", 324 | "start": 1632120213163, 325 | "end": 1632120213182, 326 | "duration": 19, 327 | "pid": 88366, 328 | "index": 40 329 | }, 330 | { 331 | "name": "Require(32) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg/app/extend/helper.js", 332 | "start": 1632120213183, 333 | "end": 1632120213183, 334 | "duration": 0, 335 | "pid": 88366, 336 | "index": 41 337 | }, 338 | { 339 | "name": "Load app.js", 340 | "start": 1632120213184, 341 | "end": 1632120213245, 342 | "duration": 61, 343 | "pid": 88366, 344 | "index": 42 345 | }, 346 | { 347 | "name": "Require(33) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-session/app.js", 348 | "start": 1632120213184, 349 | "end": 1632120213185, 350 | "duration": 1, 351 | "pid": 88366, 352 | "index": 43 353 | }, 354 | { 355 | "name": "Require(34) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-security/app.js", 356 | "start": 1632120213185, 357 | "end": 1632120213186, 358 | "duration": 1, 359 | "pid": 88366, 360 | "index": 44 361 | }, 362 | { 363 | "name": "Require(35) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-onerror/app.js", 364 | "start": 1632120213187, 365 | "end": 1632120213194, 366 | "duration": 7, 367 | "pid": 88366, 368 | "index": 45 369 | }, 370 | { 371 | "name": "Require(36) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-i18n/app.js", 372 | "start": 1632120213194, 373 | "end": 1632120213212, 374 | "duration": 18, 375 | "pid": 88366, 376 | "index": 46 377 | }, 378 | { 379 | "name": "Require(37) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/app.js", 380 | "start": 1632120213212, 381 | "end": 1632120213213, 382 | "duration": 1, 383 | "pid": 88366, 384 | "index": 47 385 | }, 386 | { 387 | "name": "Require(38) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-schedule/app.js", 388 | "start": 1632120213213, 389 | "end": 1632120213214, 390 | "duration": 1, 391 | "pid": 88366, 392 | "index": 48 393 | }, 394 | { 395 | "name": "Require(39) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-multipart/app.js", 396 | "start": 1632120213214, 397 | "end": 1632120213215, 398 | "duration": 1, 399 | "pid": 88366, 400 | "index": 49 401 | }, 402 | { 403 | "name": "Require(40) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-logrotator/app.js", 404 | "start": 1632120213215, 405 | "end": 1632120213216, 406 | "duration": 1, 407 | "pid": 88366, 408 | "index": 50 409 | }, 410 | { 411 | "name": "Require(41) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-static/app.js", 412 | "start": 1632120213216, 413 | "end": 1632120213216, 414 | "duration": 0, 415 | "pid": 88366, 416 | "index": 51 417 | }, 418 | { 419 | "name": "Require(42) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/app.js", 420 | "start": 1632120213216, 421 | "end": 1632120213243, 422 | "duration": 27, 423 | "pid": 88366, 424 | "index": 52 425 | }, 426 | { 427 | "name": "Require(43) /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-mock/app.js", 428 | "start": 1632120213244, 429 | "end": 1632120213244, 430 | "duration": 0, 431 | "pid": 88366, 432 | "index": 53 433 | }, 434 | { 435 | "name": "Before Start in /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-watcher/lib/init.js:15:14", 436 | "start": 1632120213249, 437 | "end": 1632120213510, 438 | "duration": 261, 439 | "pid": 88366, 440 | "index": 54 441 | }, 442 | { 443 | "name": "Load Service", 444 | "start": 1632120213253, 445 | "end": 1632120213256, 446 | "duration": 3, 447 | "pid": 88366, 448 | "index": 55 449 | }, 450 | { 451 | "name": "Load \"service\" to Context", 452 | "start": 1632120213253, 453 | "end": 1632120213256, 454 | "duration": 3, 455 | "pid": 88366, 456 | "index": 56 457 | }, 458 | { 459 | "name": "Load Middleware", 460 | "start": 1632120213256, 461 | "end": 1632120213492, 462 | "duration": 236, 463 | "pid": 88366, 464 | "index": 57 465 | }, 466 | { 467 | "name": "Load \"middlewares\" to Application", 468 | "start": 1632120213256, 469 | "end": 1632120213480, 470 | "duration": 224, 471 | "pid": 88366, 472 | "index": 58 473 | }, 474 | { 475 | "name": "Load Controller", 476 | "start": 1632120213492, 477 | "end": 1632120213496, 478 | "duration": 4, 479 | "pid": 88366, 480 | "index": 59 481 | }, 482 | { 483 | "name": "Load \"controller\" to Application", 484 | "start": 1632120213492, 485 | "end": 1632120213496, 486 | "duration": 4, 487 | "pid": 88366, 488 | "index": 60 489 | }, 490 | { 491 | "name": "Load Router", 492 | "start": 1632120213497, 493 | "end": 1632120213500, 494 | "duration": 3, 495 | "pid": 88366, 496 | "index": 61 497 | }, 498 | { 499 | "name": "Require(44) app/router.js", 500 | "start": 1632120213497, 501 | "end": 1632120213499, 502 | "duration": 2, 503 | "pid": 88366, 504 | "index": 62 505 | }, 506 | { 507 | "name": "Before Start in /Users/saqqdy/www/saqqdy/egg-http-proxy-plus/node_modules/egg-core/lib/egg.js:303:10", 508 | "start": 1632120213500, 509 | "end": 1632120213504, 510 | "duration": 4, 511 | "pid": 88366, 512 | "index": 63 513 | } 514 | ] 515 | -------------------------------------------------------------------------------- /test/fixtures/apps/http-proxy-test/run/router.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": null, 4 | "methods": ["HEAD", "GET"], 5 | "paramNames": [], 6 | "path": "/", 7 | "regexp": "/^(?:\\/(?=$))?$/", 8 | "stack": ["wrappedController"] 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /test/http-proxy.test.js: -------------------------------------------------------------------------------- 1 | const mock = require('egg-mock') 2 | const express = require('express') 3 | 4 | function startProxyServers() { 5 | const listeners = [] 6 | const proxy1 = express() 7 | const proxy2 = express() 8 | 9 | proxy1.get('/proxy1', (req, res) => { 10 | res.send('from proxy1') 11 | }) 12 | 13 | proxy2.get('/proxy2', (req, res) => { 14 | res.send('from proxy2') 15 | }) 16 | 17 | listeners.push(proxy1.listen(3000)) 18 | listeners.push(proxy2.listen(3001)) 19 | 20 | return function proxy() { 21 | listeners.forEach(listener => { 22 | listener.close() 23 | }) 24 | } 25 | } 26 | 27 | describe('test/http-proxy.test.js', () => { 28 | let app, closeProxyServers 29 | 30 | before(() => { 31 | closeProxyServers = startProxyServers() 32 | app = mock.app({ 33 | baseDir: 'apps/http-proxy-test' 34 | }) 35 | return app.ready() 36 | }) 37 | 38 | after(() => { 39 | app.close() 40 | closeProxyServers() 41 | }) 42 | 43 | afterEach(mock.restore) 44 | 45 | it('should target proxy1', () => { 46 | return app.httpRequest().get('/proxy1').expect(200, 'from proxy1') 47 | }) 48 | 49 | it('should target proxy2 with path rewrite', () => { 50 | return app.httpRequest().get('/api/proxy2').expect(200, 'from proxy2') 51 | }) 52 | }) 53 | --------------------------------------------------------------------------------