cloudflare / cloudflare/workers-sdk
🐛 BUG: Error with wrangler dev and HTTPS localhost sub-requests
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 187
Description
### Which Cloudflare product(s) does this pertain to?
Miniflare
### What version(s) of the tool(s) are you using?
wrangler 3.53.1
### What version of Node are you using?
v21.1.0
### What operating system and version are you using?
Mac Somona 14.4.1
### Describe the Bug
### Observed behavior
Sub-request to **https**://localhost result in error.
### Expected behavior
HTTP requests work, would expect HTTPS requests to also work. Or a documented way to turn off HTTPS validation.
### Steps to reproduce
- npx wrangler dev
- fetch('https://localhost:5000')
### Please provide a link to a minimal reproduction
_No response_
### Please provide any relevant error logs
[wrangler:inf] Ready on http://localhost:8787
✘ [ERROR] WARNING: known issue with `fetch()` requests to custom HTTPS ports in published Workers:
- https://localhost:5000/api/impersonate - the custom port will be ignored when the Worker is
published using the `wrangler deploy` command.
✘ [ERROR] Uncaught (async) Error: internal error
[wrangler:err] Error: internal error
at async passThroughHandler (file:///Users/daniel/Projects/api-worker/src/handlers/pass-through.handler.ts:13:10)
at async Object.handle (file:///Users/daniel/Projects/api-worker/node_modules/itty-router/Router.js:1:614)
at async Object.fetch (file:///Users/daniel/Projects/api-worker/src/index.ts:241:12)
at async jsonError (file:///Users/daniel/Projects/api-worker/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:10)
at async drainBody (file:///Users/daniel/Projects/api-worker/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts:5:10)
[wrangler:inf] POST /users/v1/tokens 500 Internal Server Error (99ms)
Contributor guide
Research direction
Reproduce the issue with `npx wrangler dev` and `fetch('https://localhost:5000')`, using the reported Wrangler, Node, and macOS versions. Compare the failing HTTPS request with a working HTTP request and determine whether the expected outcome is support for HTTPS localhost sub-requests or documented HTTPS-validation configuration; the relevant application traces mention `src/handlers/pass-through.handler.ts` and `src/index.ts`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100