workers-sdk
workers-sdk copied to clipboard
Support local hostnames w/ TLS for `wrangler dev` remote mode
(submitted by request from discord)
Currently, there is no way to get wrangler remote mode to bind to a local hostname. This prevents users from testing wildcard subdomains and workers based on Cloudflare for SaaS, since there is no way to provide a TLS certificate, no way to bind to a hostname other than localhost, and no way to provide a zone not registered with Cloudflare. For example, I have a production worker that responds to subdomain wildcards on zone mydomain.com, allowing https://some-random-string.mydomain.com urls, and a development version of the worker that does the same locally, allowing https://some-random-string.mydomain.com.test urls.
This use case is well served by wrangler local mode thanks to Miniflare (along with DNSMasq and mkcert on macOS), which allows bindings to arbitrary hostnames provided, backed up by custom certificates provided in [miniflare.https] in wrangler.toml. It would be nice to see parity with this support for remote mode.
Thanks for filing this. Off the top of my head, I'm thinking we could add a [dev.https] section in wrangler.toml, that mirrors miniflare's configuration, and adds it to remote mode.
Assigning to @cameron-robey for exploring solutions
FWIW: For people like me that uses Workers Sites that is also relevant. My Worker Sites uses de subdomain as key to change the entry point of the index and others things.
Hi @jed! Thanks for flagging this. In an effort to remove stale issues so we can have better signal on current friction points, we’re closing out issues that have not been updated within the last 6 months. Unifying the proxies in front of remote and local mode is something we're planning to do as part of the ongoing conversion of Wrangler to a library. A byproduct of this work will be support for HTTPS in wrangler dev --remote.