Caddy Proxy
Caddy’s simple configuration makes it straightforward to proxy usertrax through your domain.
Add to your Caddyfile
yourdomain.com {# Proxy the tracking scripthandle /cvs.js {reverse_proxy https://usertrax.io {header_up Host usertrax.io}header Cache-Control "public, max-age=86400"}# Proxy the events endpointhandle /api/usertrax/events {reverse_proxy https://api.usertrax.io {header_up Host api.usertrax.ioheader_up X-Auth-Key {http.request.header.X-Auth-Key}}}# Your other site configuration...handle {file_server}}Update your HTML
<script>window.usertraxConfig = {endpoint: "/api/usertrax/events",};</script><script src="/cvs.js" data-key="YOUR_API_KEY" defer></script>Validate and reload
Terminal-Fenster caddy validatecaddy reload
Verification
Section titled “Verification”- Visit your website
- Open the Network tab
- Confirm requests go through your domain
Troubleshooting
Section titled “Troubleshooting”- 401 Unauthorized: Ensure
X-Auth-Keyis forwarded withheader_up - Caddy handles HTTPS certificates automatically — no extra SSL config needed for the upstream proxy