HTTPS reverse proxy
Overview
One process listens on 443/80 and forwards requests to each service by path prefix (or subdomain). HTTP/2 is supported on the browser side, and Let’s Encrypt certificates (DNS-01) are issued and renewed automatically, so you don’t need to install Caddy or nginx. For a service’s path, port and stripPrefix see configuration.md; for the operating-system differences in binding 443/80 see getting-started.md.
There are three certificate modes, chosen with tls.mode (unset = letsencrypt, so old configs need no change):
tls.mode |
Certificate source | Needs |
|---|---|---|
letsencrypt (default) |
Let’s Encrypt, DNS-01 validation, issued and renewed automatically | A domain plus a DNS provider token: Cloudflare (the domain is hosted on Cloudflare) or DuckDNS (a free <name>.duckdns.org) |
local-ca |
devhub generates its own root CA and issues the server certificate, re-signing automatically before expiry | No domain or token; you trust the root CA once on your machine (fallback, see the recommended order below) |
custom |
Your own certificate and private key files | Two PEM files; devhub doesn’t renew, just replace the files |
Recommended order
| Order | Situation | Mode |
|---|---|---|
| 1 | You have no domain | DuckDNS (free; leave tls.mode as letsencrypt) |
| 2 | You have your own domain | Cloudflare (leave tls.mode as letsencrypt) |
| 3 | Offline, or your company network blocks outbound access | Local CA (fallback) |
DuckDNS and Cloudflare certificates are publicly trusted, so browsers, Firefox and Node.js need no extra trust setup, and macOS and Windows never need sudo. local-ca needs you to install the root CA trust once per machine (some platforms need sudo, and Firefox needs a separate import), so it comes last.
| DuckDNS | Cloudflare | local-ca |
|
|---|---|---|---|
| Needs sudo | No | No | Depends on the platform: macOS system keychain and Linux do; Windows (current user) doesn’t |
| Needs outbound network | For issuance and renewal | For issuance and renewal | No |
| Needs a token | Yes (DuckDNS) | Yes (Cloudflare API token) | No |
| Needs your own domain | No | Yes | No |
May need /etc/hosts |
Possibly: a public domain resolving to 127.0.0.1 may be blocked by DNS rebinding protection, see troubleshooting.md |
Same | No: with dev.localhost browsers always resolve to the local machine |
| Certificate in public CT logs | Yes (the host name becomes publicly searchable) | Yes | No |
| Needs root CA trust installed | No | No | Yes (Firefox imports it separately) |
sudo for 443/80 is unrelated to the certificate mode: this table is only about certificates. On Linux an ordinary user can’t bind ports below 1024, whichever mode you use: either run setcap once (grants only that node), or set DEVHUB_HTTPS_PORT to a high port (the URL then needs the port, for example https://dev.example.com:8443/<path>). macOS and Windows need no sudo. See getting-started.md.
Without proxy.host the proxy is off and everything else works as usual; the management UI stays available at http://127.0.0.1:4999.
At boot the proxy starts before the management API, so a proxy failure doesn’t affect 127.0.0.1:4999.
Cloudflare
For new members with no existing setup.
-
Bring a domain: have a domain or subdomain such as
dev.example.comwith DNS hosted on Cloudflare. -
Point DNS to this machine: add an A record
dev.example.com→127.0.0.1(turn off the Cloudflare proxy, the grey cloud). This makes the browser connect to your own machine. -
Create a Cloudflare API token: in the Cloudflare dashboard go to My Profile → API Tokens → Create Token → Create Custom Token, with the permissions:
- Zone → Zone → Read
- Zone → DNS → Edit
Limit Zone Resources to the zone holding that domain. Copy the token after creating it (it is shown only once).
The token is your own secret: enter it in the management UI’s “Settings” (see the settings panel section below), or create the env file yourself in a terminal in the next step. Don’t paste it to an agent; an agent won’t ask you for it.
-
Create cf.env:
終端機視窗 mkdir -p ~/.config/devhubprintf 'CLOUDFLARE_API_TOKEN=<your-token>\n' > ~/.config/devhub/cf.envchmod 600 ~/.config/devhub/cf.envThe format is a single line
CLOUDFLARE_API_TOKEN=<token>. Keep the file at permission 600 and never put it in any repo. You can also set the environment variableCLOUDFLARE_API_TOKENinstead. -
Set proxy.host: in
services.jsonput"proxy": { "host": "dev.example.com", … }and restart devhub. The first start requests a certificate automatically, which takes some tens of seconds (the header’s Proxy row shows progress). -
After that, reach each service at
https://dev.example.com/<path>. -
If the browser can’t open it (the domain resolving to 127.0.0.1 is blocked by DNS rebinding protection), add a line
127.0.0.1 dev.example.comto the hosts file (/etc/hostson macOS/Linux,C:\Windows\System32\drivers\etc\hostson Windows), see troubleshooting.md. devhub does not update Cloudflare A records: add an A record fordev.example.compointing to127.0.0.1yourself under Cloudflare DNS → Records (Proxy status: DNS only).
Certificates and renewal: the certificate and the ACME account key are stored in certDir (default ~/.config/devhub/certs/, directory 700, key 600). At startup an existing certificate is reused if it has more than 30 days left; while devhub runs it checks every 12 hours and renews automatically near expiry, hot-reloading without a restart. The header’s Proxy row shows the expiry date and offers manual renewal (two-step confirmation). Let’s Encrypt rate-limits the same domain (5 duplicate certificates per week), so renew manually sparingly. The token is read only at issuance time and is never logged, displayed or written to other files.
DuckDNS
Without a domain of your own, you can use a free DuckDNS subdomain such as <name>.duckdns.org, with a name of your choosing.
No inbound access from the internet is needed: DuckDNS’s A record points to 127.0.0.1, so the browser only ever connects to your own machine; this machine just needs to be able to reach out to duckdns.org and Let’s Encrypt. After you get a certificate you can work offline for 90 days, but renewal (checked every 12 hours starting 30 days before expiry) needs outbound access.
-
Sign up and create a subdomain: go to https://www.duckdns.org, sign in with a GitHub, Google or similar account, enter the name you want (such as
<name>) in the domains field and press add domain. -
Set the IP to 127.0.0.1: you don’t have to. By default (
tls.duckdnsSetIp, treated astruewhen absent) devhub sets the A record automatically when testing the connection and requesting a certificate, if it isn’t127.0.0.1, and waits for it to take effect. Turn it off in the advanced section only if you use this subdomain for something else; when it is off devhub will not update your DNS records, so enter127.0.0.1in current ip on that domain’s row and press update ip yourself. -
Get the token and create the env file: the token is at the top of the DuckDNS home page.
終端機視窗 mkdir -p ~/.config/devhubprintf 'DUCKDNS_TOKEN=<your-token>\n' > ~/.config/devhub/duckdns.envchmod 600 ~/.config/devhub/duckdns.envDon’t put the file in any repo. You can also set the environment variable
DUCKDNS_TOKEN(it takes precedence over the file). -
Set
tls.dnsProvider: inservices.json:"proxy": { "host": "<name>.duckdns.org", "rules": [] },"tls": { "dnsProvider": "duckdns" }proxy.hostmust be a single-level<name>.duckdns.org, otherwise the Proxy pill’s popover shows why.tls.duckdnsEnvFilechanges the env file location, andtls.duckdnsSetIp(on by default; sets the A record automatically) is described above. -
First start:
node devhub.mjs. devhub sets DuckDNS’s TXT record and notifies Let’s Encrypt to validate only once public DNS (1.1.1.1, 8.8.8.8) can see it, usually within some tens of seconds; it waits up to about 3 minutes, and on timeout the Proxy row shows an error. When done, reach services athttps://<name>.duckdns.org/<path>. If it won’t open, see the hosts file entry in troubleshooting.md.
Limitations and security: DuckDNS allows only one TXT record per domain, so don’t have two devhub instances requesting certificates for the same domain at once. The token is read only at issuance and renewal, and logs, the UI, error messages and request URLs (as recorded in the proxy log) always mask it as token=***.
Local CA (without Let’s Encrypt)
The fallback when you are offline or your company network blocks outbound access. With tls.mode set to local-ca, devhub generates its own root CA on first start and uses it to issue the server certificate for proxy.host. No domain, no DNS token and no outbound connection are needed; the approach is the same as mkcert and Caddy’s internal issuer.
"proxy": { "host": "dev.localhost" },"tls": { "mode": "local-ca" }-
Choose a host name:
dev.localhost(or any*.localhost) is the least effort, since browsers always resolve it to the local machine per RFC 6761 and you don’t need to edit hosts; you can also use your own domain (such asdevhub.testordev.corp.example) as long as DNS or/etc/hostspoints it to127.0.0.1. -
Start devhub: it creates
rootCA.pem(the root certificate, 10 years) androotCA-key.pem(the private key, permission 600, directory 700) in~/.config/devhub/ca/(%APPDATA%\devhub\ca\on Windows), and the server certificate goes incerts/local-ca/. -
Install trust (once):
終端機視窗 devhub ca path # prints the path of rootCA.pemdevhub ca trust # prints the install commands for each platformThe commands are only printed, and you run them yourself: devhub never elevates privileges or changes the system trust on its own. macOS uses
security add-trusted-cert(the System keychain needs sudo, the login keychain doesn’t); Linux usesupdate-ca-certificates/update-ca-trust(needs sudo) orcertutilto write to Chrome/Firefox’s NSS database; Windows usescertutil -addstore(no administrator needed for the current user). Node.js programs don’t read the system trust, so also setNODE_EXTRA_CA_CERTS=<path of rootCA.pem>. Choosing “Local CA” in the Settings panel also shows the same path, fingerprint and commands. -
Open
https://dev.localhost/<path>.

- Certificate details: ECDSA P-256; the server certificate is valid for 365 days and covers
proxy.host,*.<host>,localhost,*.localhost,127.0.0.1and::1; it is re-signed and hot-reloaded 30 days before expiry (with the same 12-hour check as Let’s Encrypt). When the root CA or the host name changes, the old server certificate is detected and re-signed. - The root CA private key is the trust anchor: whoever gets
rootCA-key.pemcan issue a certificate for any website that your machine will trust. It exists only in the CA directory and never appears in logs, the management API, CLI output or a repo; don’t copy it to another machine, put it in a synced folder or back it up to the cloud. devhub sets no Name Constraints, so install the trust only on your own development machine and don’t hand it out to colleagues. - Incomplete or expired CA files: when only one file remains, the certificate and private key don’t match, or the root CA has expired, devhub refuses to start the proxy and explains why; it doesn’t recreate them automatically (that would invalidate trust you already installed). To recreate, delete the two files in
ca/first, then install trust again. - Switching back to Let’s Encrypt: the panel or
devhub tls apply --yes --set mode=letsencrypt --reissuerequests again using the existing settings (rate-limited, needs a second confirmation); switching tolocal-caneeds none, since nothing is requested externally. - The root CA is not removed from the system trust automatically: when you no longer need it, clear it with the removal commands listed by
devhub ca trust.
Your own certificate
If you already have a certificate signed by an internal company CA, or files you generated with mkcert/openssl:
"proxy": { "host": "dev.corp.example" },"tls": { "mode": "custom", "certFile": "~/certs/dev.crt", "keyFile": "~/certs/dev.key" }- Both files must be PEM, and the private key must be unencrypted. They are reread at startup and every 12 hours: the private key must match the certificate, it must not be expired and it must cover
proxy.host(SAN); if any of these fails, the Proxy row shows the reason. devhub doesn’t renew: after you replace the files, it hot-reloads automatically within 12 hours, or press manual renewal to reread immediately. - Paths are accepted only under the home directory. “Test connection” in the Settings panel runs the same checks.
- Trust for the certificate is decided by the CA that issued it; if it is a self-signed CA, you still have to install trust on the machine (
devhub ca trusthandles only the root CA devhub generates itself).
Advanced routing
All of this is optional and set on the service; a service without these settings behaves exactly as before. For the list of fields see configuration.md; in the UI it is the “Advanced routing” section of the service editor (collapsed by default, opened automatically when something is set).
"shopApi": { "path": "/shop-api", "port": 5001, "stripPrefix": true },"docs": { "host": "docs", "path": "/", "port": 5002 },"legacy": { "path": "/old", "port": 5003, "rewritePrefix": "/v2", "timeout": 30, "requestHeaders": { "X-Env": "dev", "Cookie": null }, "responseHeaders": { "X-Frame-Options": null } }
- Subdomain (
host):"host": "docs"expands todocs.<proxy.host>, and you can also write the full name. It coexists with path prefixes:path: "/"means all paths under that host name, or you can write just a prefix such as/docs. A service withhosttakes effect only on that host name and takes priority; a service withouthostapplies to all host names (as before). The samepathcan be reused under differenthostvalues.- The certificate must cover the subdomain:
local-caalready includes*.<proxy.host>and needs nothing;customneeds your own certificate with a wildcard (*.<host>) or each subdomain; inletsencryptmode devhub requests only the single nameproxy.host, with no wildcard, so subdomains give certificate errors; uselocal-cainstead. Requesting wildcard certificates is deliberately not built in, since DuckDNS allows only one TXT record per domain, so validatinghostand*.hosttogether would fail, and behavior other than Cloudflare’s can’t be guaranteed. - The subdomain must resolve to
127.0.0.1:*.localhostalways resolves locally in browsers; a custom domain needs a DNS wildcard or one/etc/hostsline each.
- The certificate must cover the subdomain:
- Path:
stripPrefix: trueremovespathbefore forwarding;rewritePrefix: "/v2"replacespathwith/v2(/shop/x→/v2/x); choose one of the two. - Headers:
requestHeadersandresponseHeadersare{name: value}, and a value ofnullremoves the header (names are case-insensitive). AresponseHeadersvalue can also be[{from, to}]= replace a substring inside the existing header value (skipped when the header is absent, for example"Content-Security-Policy": [{ "from": "frame-src 'self'", "to": "frame-src 'self' https://x" }]). The oldrewriteHeadersfield is still readable and is merged intoresponseHeadersautomatically (for the same header,responseHeaderswins). Request headers are applied after X-Forwarded-*, so they can override those too. - Host and X-Forwarded-*: by default the browser’s
Hostis preserved andX-Forwarded-For/Proto/Hostare overwritten (values sent by the client aren’t trusted).changeOrigin: truechanges the upstreamHostto127.0.0.1:<port>(the original Host remains inX-Forwarded-Host);xForwarded: falsesends noX-Forwarded-*at all. - Timeout:
timeout: 30(seconds) = if the upstream sends no data for 30 seconds in a row, respond 504 and abort. It is an idle timeout, so a stream that keeps delivering data is unaffected; but SSE without a heartbeat for longer than that is cut. It doesn’t apply to WebSocket. Without it there is no timeout. - WebSocket and SSE: WebSocket upgrades are forwarded as they are (HMR works, and path rewriting and header settings apply as well), while SSE and other streaming responses arrive chunk by chunk without buffering.
- HTTP/2: the same 443 negotiates by ALPN; browsers use
h2, WebSocket uses HTTP/1.1, and the backend is always HTTP/1.1. You can verify withcurl --http2. - No matching service (404): browsers (
Acceptincludestext/html) see an explanation page that lists the service paths configured now with their state (clickable), a button to open the admin UI and how to add a service. It lists only paths, service names and states, never ports or settings, and a service that declareshostis listed only on that hostname. Whenserver.adminViaProxyis off (/devhub/returns 404) it shows the local addresshttp://127.0.0.1:4999instead. Other clients (APIs, curl) still get the plain-text<host> dev proxy: no routeand a 404. The root path/: when you assign/to a service, that service always answers/and this page never appears. When no service holds/, opening the domain’s home page (https://<proxy.host>/) in a browser redirects (302) to the admin UI at/devhub/(server.adminViaProxyis on by default). When it is off, the page explains that the admin UI lives at/devhub/, that you first tick “Allow opening the admin UI through the proxy host (/devhub/)” under Settings (or rundevhub server proxy-admin on), and thathttp://127.0.0.1:4999works meanwhile. The redirect is a 302 and not cached, so giving/to a service later takes effect at once; curl and other non-browser requests, and paths other than/, are not redirected.

- Backend not running: browsers see an explanation page listing the service name, the state devhub sees (not started/starting/building/stopping) and an “Open devhub to start the service” button; other clients (API, curl) still get the plain-text 502, and a timeout is 504.
- Start and come back: the button opens the admin UI, which asks right away “Start
with this worktree?” (the currently selected worktree is preselected, and you can pick another). Confirm, and it starts the service and takes you back to the original URL, path and query string included. Cancelling the question and starting the service by hand on its row works too: you are taken back once it starts, and “Stay here” cancels that. With server.adminViaProxyoff, the button openshttp://127.0.0.1:4999on this machine instead. - Automatic checking: when a GET request hits an unreachable backend, the page checks the service by itself, shows progress, and opens the service as soon as it responds; if the start fails it shows the reason with a “View log” link and stops (the detailed reason only goes to a browser on this machine). The checks carry
X-Devhub-Probe: 1and are answered by the proxy itself, never forwarded to the backend; the interval grows from 1 to 10 seconds, is 30 seconds in background tabs, and checking stops after 15 minutes. Timeout (504) pages and non-GET requests don’t check. - Security: confirming and starting happen in the admin UI; the page never calls the admin API, and the admin API’s Host/Origin/Sec-Fetch-Site checks,
server.adminViaProxyand the token are unchanged. The page’s CSP allows only the inline checking script (pinned by hash), connecting back to the same origin. The return URL must be https on the proxy domain, one of its subdomains, or a service’s declaredhost. - Page language and style: the pages follow the browser’s
Accept-Languagein Traditional Chinese, English, Japanese or Korean (any Chinese maps to Traditional Chinese, anything else to English); they match the admin UI’s look and are self-contained (no external resources; only the backend-not-responding page carries the inline checking script).


The proxy rules in proxy.rules also accept rewritePrefix, requestHeaders, responseHeaders, changeOrigin, xForwarded and timeout.
Trade-offs: modeled on local-development usage of Caddy, Traefik, portless and nginx, devhub includes only the subset that takes a line or two of config and has clear value for local development (subdomains, rewriting, headers, timeouts, HTTP/2, the error page). Not done: multiple upstreams per route/load balancing (to alternate between worktrees, just give each service its own path or subdomain), HTTP/3, compression, caching, backend TLS, regular-expression rewriting and retries.
Settings panel
The “Settings” icon button at the right of the header opens a panel where you can adjust the certificate mode (Let’s Encrypt/local CA/your own certificate), proxy.host, tls.dnsProvider, each provider’s env file path, the token, tls.txtResolvers, tls.duckdnsSetIp and the certificate directory without hand-editing services.json. The TXT resolvers, “set the A record to 127.0.0.1 automatically” (on by default) and the certificate directory are advanced options in an expandable section.

Once the HTTPS proxy is set up and usable (listening, certificate valid), the admin UI opened from http://127.0.0.1:4999 suggests “you can now open the admin UI at https://<proxy.host>/devhub/” with a button. If server.adminViaProxy is off, the suggestion first explains the trade-off (once allowed, anyone on this machine who knows the domain can manage devhub at that address; it still accepts local connections only and you can turn it off any time), and only “Allow and open” writes the setting. “No thanks” dismisses it and is remembered per browser (localStorage; a different domain asks again); it isn’t shown when the certificate failed, the proxy is unhealthy, or you already opened the UI from the proxy domain.

There are two separate switches at the top of the panel; ticking one writes the setting directly and it isn’t part of the “Apply” flow: “Start devhub automatically when an agent session begins” (off by default, server.autoStart, see agents.md) and “Allow opening the admin UI through the proxy domain (/devhub/)” (on by default, server.adminViaProxy; when unticked, /devhub/ on the proxy domain returns 404 and the admin UI is only at http://127.0.0.1:4999, see development.md). When the management API has a token enabled, the panel also shows where the token file is.
- The token is write-only: leaving the input empty = no change; the screen shows only “set/not set” and the file path, and API responses, error messages and logs never contain the token. “Clear token” removes that line from the env file when you apply. Writes are atomic (temporary file → rename), the file is 600 and its directory 700, and other variables and comments in the file are preserved as they were. A same-named environment variable (
CLOUDFLARE_API_TOKEN/DUCKDNS_TOKEN) still takes precedence over the file, and the panel marks it. - Path fields: leaving the env file or certificate directory empty = the default path (shown under the field:
~/.config/devhub/…on macOS/Linux,%APPDATA%\devhub\…on Windows). “Browse…” next to the env file, own-certificate file, private key file and certificate directory fields (the directory picks a folder, the rest pick files; labels say they are absolute paths) opens a native dialog on the computer running devhub (osascripton macOS, PowerShell on Windows,zenityorkdialogon Linux; a browser can’t see the full path, so the server opens it). It returns only the path and never reads the file, and the path must still be under your home directory; with no desktop or none of those programs, the panel says so and asks you to type the path. The path under the token label, under the own-certificate and private key files, and under the certificate directory is a link that shows the file in Finder/Explorer (on Linux it opens the containing folder; if the file doesn’t exist yet it opens the nearest existing directory); only the env files, own-certificate file, private key file and certificate directory in the current settings can be opened, never an arbitrary path. Both are UI-only (POST /api/tls/pick-file,POST /api/tls/reveal); the CLI gets paths fromdevhub tls showand sets them with--set cfEnvFile=…. - Where the certificates really are: the panel shows the absolute path in use under the field. A newly created Windows config no longer hard-codes
~/.config/devhub/certs; by default it sits in%APPDATA%\devhubnext to the token file. Existing configs are not changed: a Windows user whose config already says~/.config/devhub/certskeeps the certificates inC:\Users\<you>\.config\devhub\certs, which the panel shows as it is; change the path yourself to unify them (the existing certificates are moved). - DuckDNS-only items: “Set the A record to 127.0.0.1 automatically” (on by default) and “TXT resolvers” (DoH, UDP) sit in the advanced section “DuckDNS advanced: A record and TXT resolvers” and appear only when the DNS provider is duckdns; Cloudflare doesn’t use them.
- After you apply: when a token is written or cleared successfully the input is emptied (never echoed), the label switches to “set” and the panel says the token was saved; if any step fails (path not writable, permissions, unreadable after writing) the panel shows an error with the file path, keeps the token you typed so you can retry, and never fails silently.
- Test connection (doesn’t request a certificate): for Cloudflare it checks that the zone exists and DNS records are readable (when the zone returns permission information it also confirms DNS edit permission, otherwise it notes that this can’t be confirmed without writing); DuckDNS has no read-only API, so it validates the token and subdomain by clearing that subdomain’s TXT record with
clear=true(normally empty). Then, if the A record isn’t127.0.0.1andtls.duckdnsSetIpis not turned off (on by default), it sets it to127.0.0.1and waits for public DNS to pick it up (up to about 30 seconds). It also checks whether the host name resolves to127.0.0.1. When resolution fails it queries the A record over public DoH to tell the cause apart: public DNS has no A record or not127.0.0.1(DuckDNS is set automatically; when it is off, setting fails, or the provider is Cloudflare, the result says devhub will not (could not) update your DNS records and what you have to do yourself, and with it off there is a one-time “Set A record now” button, in the CLIdevhub tls test --set-ip --yes); public DNS already says127.0.0.1but this machine can’t resolve it, in which case it asks the local DNS directly: an answer with no records plus an SOA is negative caching (the name was queried before the A record was set; the result shows the minutes left and the flush command, and does not suggest hosts), and only a failure that persists and is not a cache (DNS rebinding protection) suggests editing the hosts file (WindowsC:\Windows\System32\drivers\etc\hosts, needs Administrator; macOS/Linux/etc/hosts, needs sudo). The result is shown inside the panel. - Certificate mode: choosing “Local CA” makes the panel show the root CA path, SHA-256 fingerprint and the trust commands for each platform (the current platform’s expanded at the top); choosing “Your own certificate” shows the certificate and private key file fields; only “Let’s Encrypt” has the DNS provider and token. After switching modes, applying re-issues/loads the certificate and hot-reloads it; only switching to Let’s Encrypt needs a second confirmation.
- Apply: writes the token first, then
services.json(atomically). In Let’s Encrypt mode a certificate is requested again only when the host name or DNS provider changes, with a second confirmation in the page (also enforced on the server), because Let’s Encrypt limits the number of requests; when the host name changes and that host already has a valid certificate, it is reused, and when only the provider changes a new request is forced to validate the new provider. On success the certificate is hot-reloaded without a restart; after a host name change, open the new URL (the panel shows it, and it must resolve to127.0.0.1). Other field changes don’t request certificates, and changing the certificate directory moves the existing certificate and ACME account key to the new directory. - Rollback on failure: if any step of certificate issuance or file writing fails, the env file is restored and the config isn’t written; the old certificate and settings keep working and the panel shows the reason.
- Security: the new API (
/api/tls*) uses the same Host/Origin/X-Devhubchecks. Path fields accept only paths under the home directory and reject.., relative paths and the home directory itself; the env file can’t sit directly in the home directory (its directory is set to 700). Fields locked by environment variables (DEVHUB_CF_ENV,DEVHUB_DUCKDNS_ENV,DEVHUB_CERT_ROOT,DEVHUB_DNS_PROVIDER) can’t be changed by the panel.
The token is your own secret, entered here: an agent doesn’t ask for it or handle it, and won’t ask you to paste it into the conversation; when it’s missing or wrong, the messages an agent or the CLI sees point back to this panel (https://<proxy host>/devhub/ or http://127.0.0.1:4999 → “Settings” at the top right). devhub tls apply also has --token-stdin/--token-file, an alternative for you to run in your own terminal; an agent won’t run them for you.
Corporate proxy
Outbound connections (Let’s Encrypt, Cloudflare, DuckDNS) go through a corporate proxy according to environment variables:
HTTPS_PROXY=http://proxy.corp.example:8080 NO_PROXY=.corp.example node devhub.mjsHTTPS_PROXY,HTTP_PROXYandNO_PROXYare supported (either case);localhostand127.0.0.1always connect directly and are unaffected.- It uses Node’s built-in
http.setGlobalProxyFromEnv, with no extra package. The minimum is Node 22.21 (or 24.5); on an older version devhub prints a warning at startup and connects directly. - The admin UI and traffic the reverse proxy forwards to local services are unaffected.
- DuckDNS’s TXT propagation check uses both DNS-over-HTTPS (through fetch, so via the proxy) and UDP 53 against public resolvers, and passes when either finds it, so it also works when the corporate network blocks UDP 53.
Migrating from an existing reverse proxy
Rewrite each reverse_proxy route as a service:
- Path match
/fooand/foo/*→path: "/foo". - Forward target
127.0.0.1:5001→port: 5001. - If the prefix is stripped before forwarding (Caddy’s
uri strip_prefix, nginx’s trailing slash onproxy_pass) →stripPrefix: true, otherwisefalse. - Routes that only return fixed content or redirect →
respond/redirectinproxy.rules; paths that are only forwarded and don’t belong to a service (such as HMR) → aproxyrule, see configuration.md. - Replacing, adding or removing response headers (Caddy’s
header_down) →responseHeaders; request headers (header_up) →requestHeaders; splitting by host name (@api host api.example.com) →host, see Advanced routing.
Both before and after migrating, make sure the old reverse proxy process has really exited, otherwise 443/80 stays occupied (see troubleshooting.md).
Troubleshooting
Symptoms such as certificates, binding 443/80, DNS rebinding (/etc/hosts), corporate networks and DuckDNS propagation timeouts are collected in troubleshooting.md.
Limitations
- DNS providers supported in Let’s Encrypt mode: Cloudflare and DuckDNS (DNS-01). Other providers must be added to
src/server/dnsproviders.mjsyourself (implementingsetTxtandremoveTxtis enough); for a domain on neither, uselocal-caorcustom. - The local CA issues only for
proxy.host(a single host name plus wildcard subdomains) and doesn’t support several unrelated domains; you install trust yourself and devhub never elevates privileges; there is no revocation (CRL/OCSP) or root CA rotation, so changing the root CA means deleting the files and recreating them. - Your own certificate isn’t renewed, and encrypted private keys aren’t supported.
- HTTP/2 (ALPN) is supported on the browser side and the backend is always HTTP/1.1; there is no HTTP/3, compression or caching; WebSocket over HTTP/2 (extended CONNECT) isn’t supported, and browsers fall back to HTTP/1.1.
- There are no multiple upstreams or load balancing; Let’s Encrypt mode doesn’t request wildcard certificates, so subdomain routes need
local-caor your own wildcard certificate.