Registry / devops / vite-plugin-caddy-multiple-tls

vite-plugin-caddy-multiple-tls

JSON →
library1.8.1jsnpmunverified

Vite plugin (v1.8.1) that runs Caddy alongside Vite to provide local HTTPS with automatic per-branch domains like `<repo>.<branch>.localhost`. Supports Vite 3-8, Node >=22. Ships TypeScript types. Key differentiators: multi-instance isolation via ownership tokens, automatic git-derived hostnames, no /etc/hosts editing needed for `.localhost` domains, and exported helpers (`resolveCaddyTlsDomains`, `resolveCaddyTlsUrl`) for external tooling. Actively maintained with frequent releases addressing crash recovery, port conflicts, and cross-process locks.

npm install vite-plugin-caddy-multiple-tls
INSTALL
IMPORT
SIG · VITE-PLUGIN-CADDY-
V
vite-plugin-caddy-multiple-tls
devopsjavascriptv1.8.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (caddyTls)
import caddyTls from 'vite-plugin-caddy-multiple-tls'
const caddyTls = require('vite-plugin-caddy-multiple-tls')
ESM-only (Node >=22). CommonJS require will throw.
resolveCaddyTlsDomains
import { resolveCaddyTlsDomains } from 'vite-plugin-caddy-multiple-tls'
import resolveCaddyTlsDomains from 'vite-plugin-caddy-multiple-tls'
Named export, not default. Available since v1.8.0.
resolveCaddyTlsUrl
import { resolveCaddyTlsUrl } from 'vite-plugin-caddy-multiple-tls'
import resolveCaddyTlsUrl from 'vite-plugin-caddy-multiple-tls'
Named export, not default. Available since v1.8.0.

Minimal Vite config enabling automatic HTTPS via Caddy with git-derived domain.

// vite.config.js import { defineConfig } from 'vite'; import caddyTls from 'vite-plugin-caddy-multiple-tls'; export default defineConfig({ plugins: [caddyTls()] }); // Then run: npx vite // Terminal output: // 🔒 Caddy is proxying your traffic on https // 🌍 https://my-repo.my-branch.localhost
Debug
Known issues
breakingSince v1.7.0, the plugin refuses to take over a hostname already owned by another live Vite server. Previously it silently replaced the other server's route.
fix
Use `instanceLabel`, `domain`, or stop the other server first.
affects: >=1.7.0
breakingSince v1.6.0, route IDs are deterministic and stale route/tls entries are replaced only when matching. This may break setups relying on non-deterministic route ordering.
fix
Ensure Caddy is restarted if routes appear missing. Use `instanceLabel` to avoid collisions.
affects: >=1.6.0
breakingNode >=22.0.0 is required. Older versions will fail with syntax errors due to ESM features.
fix
Upgrade Node to v22 or later.
affects: >=1.0.0
gotchaThe plugin defaults `server.host = true` and `server.allowedHosts = true`. If you override these, custom hostnames may not work.
fix
Keep these defaults or explicitly set `allowedHosts` to include the resolved domain.
affects: >=1.0.0
gotchaWhen using `baseDomain` other than `localhost`, you must configure DNS or /etc/hosts manually. The plugin does not modify system hosts.
fix
Add the resolved domain to your hosts file or use a wildcard DNS resolver.
affects: >=1.0.0
Errors
Common errors & fixes
Error: The plugin 'vite-plugin-caddy-multiple-tls' requires Node.js >=22.0.0
Node version is too old.
fix
Run `nvm install 22` or upgrade Node to v22+.
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using CommonJS `require()` instead of ESM `import`.
fix
Change to `import caddyTls from 'vite-plugin-caddy-multiple-tls'` and ensure your project is ESM.
Error: Hostname conflict: another live server already owns '<domain>'. Refusing takeover.
Another Vite instance with the same derived domain is running (since v1.7.0).
fix
Stop the other server, or set a unique `instanceLabel` or `domain` in plugin options.
Upgrade
Version history
1.8.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
1
Resources
vite-plugin-caddy-multiple-tls — npm install vite-plugin-caddy-multiple-tls · libregistry