Caddy Proxy Setup
Use Caddy as a reverse proxy to serve the Ovyxa tracking script and API from your own domain. This prevents ad blockers from blocking analytics requests.
Why Proxy?
Ad blockers maintain lists of known analytics domains. By proxying Ovyxa through your own domain, requests appear as first-party traffic and are not blocked.
Caddyfile Configuration
Add these reverse proxy rules to your Caddyfile:
yourdomain.com {
# Proxy the tracking script
handle /js/script.js {
reverse_proxy https://ingest.ovyxa.com {
header_up Host ingest.ovyxa.com
}
}
# Proxy the event ingestion endpoint
handle /api/event {
reverse_proxy https://ingest.ovyxa.com {
header_up Host ingest.ovyxa.com
}
}
# Your existing site configuration
handle {
# ... your site config
}
}
Update Your Tracking Script
Point the tracking script at your proxied paths:
<script
async
src="/js/script.js"
data-domain="yourdomain.com"
data-api="/api/event"
></script>
The data-api attribute tells the script to send events to your proxy endpoint instead of directly to ingest.ovyxa.com.
Full Example
example.com {
# Ovyxa tracking script proxy
handle /js/script.js {
reverse_proxy https://ingest.ovyxa.com {
header_up Host ingest.ovyxa.com
}
}
# Ovyxa event ingestion proxy
handle /api/event {
reverse_proxy https://ingest.ovyxa.com {
header_up Host ingest.ovyxa.com
}
}
# Your application
handle {
reverse_proxy localhost:3000
}
}
Verification
After setting up the proxy:
- Visit
https://yourdomain.com/js/script.js— you should see the Ovyxa tracking script - Check your browser's Network tab — requests should go to your domain, not
ingest.ovyxa.com - Verify events appear in your Ovyxa dashboard
Troubleshooting
Script returns 502 Bad Gateway
- Ensure Caddy can reach
ingest.ovyxa.com(check DNS and firewall) - Verify the
header_up Hostdirective is set
Events not being recorded
- Check the
data-apiattribute matches your proxy path exactly - Verify the
/api/eventproxy route is configured - Check Caddy logs for errors:
journalctl -u caddy
SSL/TLS errors
- Caddy handles TLS automatically — ensure your domain's DNS points to your server
- If using Caddy behind another proxy, configure trusted proxies appropriately