> ## Documentation Index
> Fetch the complete documentation index at: https://help.trfyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Proxy Trfyx through your domain

> Choose between Trfyx Managed Proxy and self-hosted proxy setups to route analytics through a domain you control.

A proxy routes Trfyx tracking requests through a domain you control instead of sending them directly to `app.trfyx.com`.

This can improve collection reliability when browser extensions, network filters, or ad blockers block known analytics domains.

<Note>
  A proxy is optional. Install the standard Trfyx tracker first, then add a proxy when you are ready for production traffic or want a first-party collection path.
</Note>

## Choose your setup

| Option | Best for | Code | DNS | Maintenance |
| - | - | - | - | - |
| **Managed Proxy** | Most websites | None | Yes | Trfyx |
| **Self-hosted proxy** | Teams that already control a server, framework, or edge layer | Yes | Usually no | You |

### Managed Proxy

Use Managed Proxy when you want the simplest setup. Trfyx provides the proxy routing and SSL; you configure a subdomain and one DNS record, then point your tracker at that hostname.

<Tip>
  Managed Proxy is recommended for most sites.
</Tip>

<CardGroup cols={2}>
  <Card title="Set up Managed Proxy" icon="shield-halved" href="/managed-proxy">
    Route Trfyx through your own subdomain without running proxy code.
  </Card>
</CardGroup>

### Self-hosted proxy

Use a self-hosted proxy when your application already has a reverse proxy, server middleware, or edge configuration that can forward Trfyx requests.

Choose the guide that matches your stack:

<CardGroup cols={3}>
  <Card title="Next.js" icon="layer-group" href="/nextjs-proxy" />

  <Card title="Express" icon="server" href="/express-proxy" />

  <Card title="PHP" icon="code" href="/php-proxy" />

  <Card title="FastAPI" icon="bolt" href="/fastapi-proxy" />

  <Card title="Flask" icon="flask" href="/flask-proxy" />

  <Card title="Vue.js" icon="code" href="/vuejs-proxy" />

  <Card title="Astro" icon="star" href="/astro-proxy" />

  <Card title="Laravel" icon="cube" href="/laravel-proxy" />

  <Card title="Nginx" icon="network-wired" href="/nginx-proxy" />

  <Card title="Caddy" icon="lock" href="/caddy-proxy" />

  <Card title="Firebase Hosting" icon="fire" href="/firebase-proxy" />

  <Card title="DigitalOcean" icon="cloud" href="/digitalocean-proxy" />
</CardGroup>

## What should be proxied?

A working proxy needs to forward both:

1. The Trfyx browser script.
2. The event collection endpoint.

For self-hosted setups, preserve the visitor's original IP information when forwarding requests. If every visitor appears to come from your server or proxy location, the proxy is not forwarding the client IP correctly.

## Verify installation

<Steps>
  <Step title="Open your production website">
    Load a live page on your site.
  </Step>

  <Step title="Check the network panel">
    Open **Developer Tools → Network** and reload the page.
  </Step>

  <Step title="Confirm the script loads through your domain">
    Check that `script.js` is requested from your domain rather than `app.trfyx.com`.
  </Step>

  <Step title="Trigger and confirm an event">
    Fire a pageview or tracked event and confirm the request also goes through your proxy.
  </Step>

  <Step title="Check Trfyx for the activity">
    Verify the new visit or event appears in your Trfyx dashboard.
  </Step>
</Steps>

<Warning>
  Do not use a proxy just because you can. A broken proxy is worse than no proxy: it can silently drop events or replace every visitor's IP with the server's IP. Verify collection and visitor location after deployment.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Goals" icon="bullseye" href="/goals">
    Define the actions that matter to your business.
  </Card>

  <Card title="Troubleshooting" icon="life-ring" href="/troubleshooting">
    Diagnose missing or unexpected data.
  </Card>
</CardGroup>


## Related topics

- [Proxy Trfyx through PHP](/php-proxy.md)
- [Proxy Trfyx through Nginx](/nginx-proxy.md)
- [Proxy Trfyx through Next.js](/nextjs-proxy.md)
- [Proxy Trfyx through FastAPI](/fastapi-proxy.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.