vercel/serve-handler

Rewrite not working with external url with the port

introverso opened this issue · 0 comments

Run with configured redirects with the specified port:

"redirects": [
    {
      "source": "/api/endpoint",
      "destination": "http://redirect-url:20000/endpoint"
    }
]

Fails with:

INFO  Gracefully shutting down. Please wait...
/Users/crbx/Library/pnpm/store/v3/tmp/dlx-35334/node_modules/.pnpm/path-to-regexp@2.2.1/node_modules/path-to-regexp/index.js:194
     throw new TypeError('Expected "' + token.name + '" to be ' + (token.repeat ? 'an array' : 'a string'))
           ^

TypeError: Expected "20000" to be a string
   at /Users/user/Library/pnpm/store/v3/tmp/dlx-35334/node_modules/.pnpm/path-to-regexp@2.2.1/node_modules/path-to-regexp/index.js:194:13
   at toTarget (/Users/user/Library/pnpm/store/v3/tmp/dlx-35334/node_modules/.pnpm/serve-handler@6.1.5/node_modules/serve-handler/src/index.js:88:9)
   at shouldRedirect (/Users/user/Library/pnpm/store/v3/tmp/dlx-35334/node_modules/.pnpm/serve-handler@6.1.5/node_modules/serve-handler/src/index.js:174:18)
   at module.exports (/Users/user/Library/pnpm/store/v3/tmp/dlx-35334/node_modules/.pnpm/serve-handler@6.1.5/node_modules/serve-handler/src/index.js:583:19)
   at run (file:///Users/user/Library/pnpm/store/v3/tmp/dlx-35334/node_modules/.pnpm/serve@14.2.3/node_modules/serve/build/main.js:181:13)
   at process.processTicksAndRejections (node:internal/process/task_queues:95:5)