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

# Proxy Supabase URLs with Custom Domain

> Replace supabase.co URLs with your own domain for better SEO and branding

## Overview

When using Supabase Edge Functions for dynamic sitemaps or APIs, your URLs look like:

```
https://abcdefghijk.supabase.co/functions/v1/sitemap
```

This guide shows you how to proxy these URLs through your own domain using Hado SEO's routing rules:

```
https://yourdomain.com/sitemap.xml
```

## Why Proxy Supabase URLs?

* **Flatten sitemap nesting**: Google only follows **one level of nesting** in sitemap indexes. If your static `sitemap.xml` points to a `<sitemapindex>` on Supabase which contains sub-sitemaps, Google won't discover them. Proxying `/sitemap.xml` directly to your Edge Function flattens this to one level
* **Better SEO**: Search engines prefer sitemaps served from your own domain
* **Professional branding**: No third-party URLs visible to users
* **Flexibility**: Change backends without updating references
* **Trust signals**: Links stay on your domain

## Set Up with Hado SEO Routing Rules

Hado SEO's [routing rules](/dashboard/routing-rules) let you proxy paths on your domain to your Supabase Edge Functions with no code changes.

<Steps>
  <Step title="Open Routing Rules">
    In your [Hado SEO Dashboard](https://hadoseo.com/dashboard), select your domain and go to the **Routing Rules** tab.
  </Step>

  <Step title="Add a Proxy Rule">
    Click **Add Rule** and configure:

    | Field       | Value                                                       |
    | ----------- | ----------------------------------------------------------- |
    | Rule Type   | **Proxy**                                                   |
    | Source Path | `/sitemap.xml`                                              |
    | Target URL  | `https://YOUR_PROJECT_REF.supabase.co/functions/v1/sitemap` |

    Replace `YOUR_PROJECT_REF` with your Supabase project reference.
  </Step>

  <Step title="Add More Rules (Optional)">
    If you have additional Supabase endpoints, add proxy rules for each:

    | Source Path    | Target URL                                                  |
    | -------------- | ----------------------------------------------------------- |
    | `/sitemap.xml` | `https://YOUR_PROJECT_REF.supabase.co/functions/v1/sitemap` |
    | `/api/posts/*` | `https://YOUR_PROJECT_REF.supabase.co/functions/v1/posts`   |
  </Step>

  <Step title="Save and Test">
    Click **Save**. Visit `https://yourdomain.com/sitemap.xml` to verify your sitemap loads correctly.
  </Step>
</Steps>

### Bulk Import via CSV

If you have many endpoints to proxy, use CSV import:

```csv theme={null}
source,destination,type,status_code,notes
/sitemap.xml,https://YOUR_PROJECT_REF.supabase.co/functions/v1/sitemap,proxy,,Dynamic sitemap
/api/posts/*,https://YOUR_PROJECT_REF.supabase.co/functions/v1/posts,proxy,,Blog posts API
```

See the [Routing Rules documentation](/dashboard/routing-rules) for more details on CSV import.

***

## Update robots.txt

Make sure your robots.txt references the proxied sitemap:

```txt theme={null}
User-agent: *
Allow: /

Sitemap: https://yourdomain.com/sitemap.xml
```

You can set this directly from your Hado SEO dashboard under **Domain Settings > Custom robots.txt** (Base44 only).

***

## Testing Your Setup

### 1. Direct Access Test

```bash theme={null}
curl -I https://yourdomain.com/sitemap.xml
```

Should return `200 OK` with `Content-Type: application/xml` or `Content-Type: text/xml`.

### 2. Content Verification

```bash theme={null}
curl https://yourdomain.com/sitemap.xml
```

Should return your sitemap XML with URLs using your custom domain.

### 3. Google Search Console

Submit the sitemap in Search Console and verify no errors.

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="502 Bad Gateway" icon="server">
    The proxy can't reach Supabase.

    **Check:**

    * Supabase function URL is correct
    * Function is deployed and working
    * No typos in project reference
  </Accordion>

  <Accordion title="Empty response" icon="file">
    Proxy returns empty content.

    **Check:**

    * Supabase function returns data when called directly
    * The source path in your routing rule matches the URL you're visiting
  </Accordion>

  <Accordion title="Wrong content type" icon="code">
    Response has incorrect Content-Type header.

    **Check:**

    * Your Supabase function sets the correct `Content-Type` header (e.g., `application/xml` for sitemaps)
  </Accordion>
</AccordionGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Dynamic Sitemaps" icon="sitemap" href="/guides/dynamic-sitemap-supabase">
    Create dynamic sitemaps with Supabase
  </Card>

  <Card title="Routing Rules" icon="route" href="/dashboard/routing-rules">
    Learn more about routing rules
  </Card>
</CardGroup>
