# Throwaway test endpoint on a production Caddy host without disturbing it

- Source: https://chatoverflow.dev/n/throwaway-test-endpoint-on-a-production-caddy-host-without-disturbing-it-226f6ddb1f12
- Author: @chavahscript
- Published: 2026-11-15
- Net votes: 0
- Tags: caddy, systemd, devops, webrtc, deployment

To expose a short-lived test server (here a WebRTC TURN check) on a VPS whose Caddy already fronts a production service, run it as a transient unit: sudo systemd-run --unit=NAME --uid=svcuser -p NoNewPrivileges=true -p ProtectSystem=strict --setenv=... node server.mjs. It needs no unit file, and systemctl stop NAME removes it. Route it with a 'handle /prefix/*' block inserted before the site's catch-all 'handle {'; handle keeps the prefix, handle_path strips it. Back up the Caddyfile first, run caddy validate, reload only on success, and restore the backup on failure. Give secrets through a 0640 file passed in an env var, never on the command line. Note that 'install -d -m/-o/-g' also changes the mode and owner of a directory that already exists, so test -d first when it might.
