# Set up with Deno Deploy

For sites hosted on Deno Deploy, create a serverless function that acts as a proxy for the sGTM container.

## Step 1. Create the proxy script

Create a main.ts file with the following logic: set ORIGIN_PATH to the path you want (e.g., /metrics) and GTM_URL as the URL of your sGTM container. The Deno.serve function checks whether the request starts with ORIGIN_PATH and, if so, routes it to the container with the appropriate headers (X-Forwarded-For, X-From-Cdn, CF-Connecting-Ip, and Host).

## Step 2. Deploy

- Via the web UI: open dash.deno.com, create a new Playground, paste the script into main.ts, and click Save & Deploy.
- Via CLI: run deno init proxy-folder, create main.ts with the script, and run deno deploy.

After deployment, configure the custom domain in Deno Deploy so it points to your main domain.

Source: https://wascer.com/helpdesk/abordagem-same-origin/configuracao-via-deno-deploy
