Serving Tally from your own domain
Tally already uses neutral paths (/t.js, /api/t), which avoids most filter lists. To make the script and its requests fully first-party, proxy two paths on your own domain to your Tally instance and point the snippet at them:
<script defer src="/_t/t.js" data-site="YOUR_SITE_ID" data-api="/_t/e"></script>Any path names work. The proxy must pass the visitor's IP in X-Forwarded-For (every example below does). If your proxy puts it in another header, set TALLY_CLIENT_IP_HEADER on Tally, such as CF-Connecting-IP. Your proxy's address must also be trusted by Tally (TALLY_TRUSTED_PROXIES); private networks are trusted by default.
Replace https://tally.example.com with your Tally URL in each example.
Next.js
// next.config.js
module.exports = {
async rewrites() {
return [
{ source: '/_t/t.js', destination: 'https://tally.example.com/t.js' },
{ source: '/_t/e', destination: 'https://tally.example.com/api/t' },
];
},
};Vercel (any framework)
{
"rewrites": [
{ "source": "/_t/t.js", "destination": "https://tally.example.com/t.js" },
{ "source": "/_t/e", "destination": "https://tally.example.com/api/t" }
]
}Netlify
# netlify.toml
[[redirects]]
from = "/_t/t.js"
to = "https://tally.example.com/t.js"
status = 200
force = true
[[redirects]]
from = "/_t/e"
to = "https://tally.example.com/api/t"
status = 200
force = trueNginx
location = /_t/t.js {
proxy_pass https://tally.example.com/t.js;
proxy_set_header Host tally.example.com;
proxy_ssl_server_name on;
}
location = /_t/e {
proxy_pass https://tally.example.com/api/t;
proxy_set_header Host tally.example.com;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_ssl_server_name on;
}Caddy
handle /_t/t.js {
rewrite * /t.js
reverse_proxy https://tally.example.com {
header_up Host tally.example.com
}
}
handle /_t/e {
rewrite * /api/t
reverse_proxy https://tally.example.com {
header_up Host tally.example.com
}
}Caddy sets X-Forwarded-For automatically.
Cloudflare Worker
export default {
async fetch(request) {
const url = new URL(request.url);
const target = url.pathname === '/_t/t.js' ? 'https://tally.example.com/t.js' : 'https://tally.example.com/api/t';
const headers = new Headers(request.headers);
headers.set('X-Forwarded-For', request.headers.get('CF-Connecting-IP') ?? '');
return fetch(target, { method: request.method, headers, body: request.method === 'POST' ? request.body : undefined });
},
};Route example.com/_t/* to the worker. Alternatively, set TALLY_CLIENT_IP_HEADER=CF-Connecting-IP on Tally when Tally itself sits behind Cloudflare.