Caddy reverse proxy for experiments.drips.network. Routes /<slug> and everything under it to internal Railway services.
Adding a new experiment is just an env var change — no code edits here.
- One public Railway service (
vibe-caddy) bound toexperiments.drips.network. - On startup,
entrypoint.shreads theVIBES_APPSenv var, generates a Caddyfile, thenexecs Caddy. - For each entry, Caddy serves
/<slug>and/<slug>/*and reverse-proxies to the configured internal target. The path is preserved (not stripped). - Path is preserved so each app's static asset URLs stay namespaced (e.g.
/<slug>/_next/...). Each Next.js experiment must therefore setbasePath: '/<slug>'in itsnext.config. Seevibes-hello-worldfor the pattern.
Comma-separated slug=host:port pairs:
VIBES_APPS=hello=vibes-hello-world.railway.internal:3000,foo=vibes-foo.railway.internal:3000
Whitespace around entries is fine.
- Deploy the new app as its own service in the same Railway project. Note its service name (e.g.
vibes-foo) and listening port (e.g.3000). - Set
BASE_PATH=/<slug>on that service so the app builds with the rightbasePath(Next.js bakes this into the build). - On
vibe-caddy, append the new entry toVIBES_APPS:VIBES_APPS=...,foo=vibes-foo.railway.internal:3000 - Redeploy
vibe-caddy.
docker build -t vibe-caddy .
docker run --rm -p 8080:8080 \
-e VIBES_APPS="hello=host.docker.internal:3000" \
vibe-caddyThen visit http://localhost:8080/hello (assuming a Next.js app is running on host port 3000 with BASE_PATH=/hello).