> ## Documentation Index
> Fetch the complete documentation index at: https://qovery-docs-new-messaging-and-agent-tasks.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting Up Cloudflare and Custom Domain on Qovery

> Configure Cloudflare as a domain provider for your Qovery applications

This tutorial guides you through configuring Cloudflare as a domain provider for applications deployed on Qovery. The process involves adding a custom domain and establishing proper DNS and SSL/TLS settings.

## Prerequisites

* Active Qovery application
* Domain ownership on Cloudflare or registrar
* Access to Cloudflare DNS settings

## Step 1: Add a Custom Domain

1. Access your application settings in Qovery Console
2. Navigate to the **Domains** section
3. Enter your Cloudflare-managed domain
4. **Critical**: Enable the **"Domain behind a CDN"** toggle

<Info>
  Enabling "Domain behind a CDN" automatically disables certificate generation since Cloudflare handles SSL/TLS management.
</Info>

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/1.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=c0885ffd8cf64757627de18341c3f2f3" alt="Add custom domain" width="2212" height="848" data-path="images/cloudflare/1.png" />
</Frame>

## Step 2: Configure Cloudflare DNS

### Add CNAME Entry

1. Go to Cloudflare DNS settings
2. Add a CNAME entry using values provided by the Qovery Console
3. The proxy mode can remain enabled

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/2.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=19b3104e5b4ecbc09b2eae32e2aa43bf" alt="Cloudflare CNAME configuration" width="3164" height="2070" data-path="images/cloudflare/2.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/3.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=dadcaadf8d3f9975e8b9323ae419fa41" alt="CNAME record details" width="3164" height="2070" data-path="images/cloudflare/3.png" />
</Frame>

## Step 3: Configure SSL/TLS Settings

The last step to configure the domain Cloudflare side properly is to use the **Full** TLS encryption for proper custom domain functionality.

1. Navigate to **SSL/TLS** settings in Cloudflare
2. Select **Full** encryption mode

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/4.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=eedb8109404fd99a714df9415fd014f7" alt="SSL/TLS Full encryption" width="2003" height="986" data-path="images/cloudflare/4.png" />
</Frame>

<Warning>
  Using "Flexible" encryption mode will not work properly with Qovery. Always use "Full" or "Full (strict)" mode.
</Warning>

## Step 4: Access Restriction Options

You have two options for restricting access to your application:

### Option 1: IP Whitelisting

Add Cloudflare IP ranges to Qovery's advanced settings to allow only Cloudflare traffic.

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/5.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=46bcf95c229c0cbc53af12f19a84f930" alt="IP whitelisting configuration" width="2358" height="1354" data-path="images/cloudflare/5.png" />
</Frame>

### Option 2: Cloudflared Tunnel

Cloudflared establishes outbound tunnels between resources and Cloudflare's network, enabling tunnel-based access without public exposure.

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/6.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=52faab1baf8cfeb551d369b8e3059f0f" alt="Cloudflared tunnel setup" width="3380" height="1278" data-path="images/cloudflare/6.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/7.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=784fed247543e98198ac8c70b0ca451d" alt="Tunnel configuration" width="3068" height="2168" data-path="images/cloudflare/7.png" />
</Frame>

## Verification

Once configured, your application should be accessible via your custom domain through Cloudflare's network.

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/8.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=d84ed6c33040f58e503c9bf5ca130079" alt="Domain verification" width="3164" height="2070" data-path="images/cloudflare/8.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/9.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=c9c9b91cbe3a4af8c60730cbe067bb3f" alt="SSL certificate verification" width="3164" height="2070" data-path="images/cloudflare/9.png" />
</Frame>

***

## Additional Configuration

### Advanced Cloudflare Features

You can leverage Cloudflare's additional features:

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/10.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=a4ee7c064eb34ebf9478670406393b7c" alt="Cloudflare WAF" width="3164" height="2070" data-path="images/cloudflare/10.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/11.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=ad7040b82a32321bd6884cdeeb6dfc3b" alt="Firewall rules" width="1083" height="301" data-path="images/cloudflare/11.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/12.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=3a185b0e0ce21649bfdf845584d267a3" alt="Page rules" width="3164" height="2070" data-path="images/cloudflare/12.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/qovery-docs-new-messaging-and-agent-tasks/AKPX5L-6uBX5fI0i/images/cloudflare/13.png?fit=max&auto=format&n=AKPX5L-6uBX5fI0i&q=85&s=a4357743c97dc9fbd0c7633862f9bb73" alt="Analytics dashboard" width="3164" height="2070" data-path="images/cloudflare/13.png" />
</Frame>

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Domain not resolving">
    * Verify CNAME record is correct
    * Check DNS propagation (can take up to 48 hours)
    * Ensure proxy mode is enabled in Cloudflare
  </Accordion>

  <Accordion title="SSL/TLS errors">
    * Confirm "Full" encryption mode is selected
    * Wait for SSL certificate provisioning (5-10 minutes)
    * Check that "Domain behind a CDN" toggle is enabled in Qovery
  </Accordion>

  <Accordion title="502 Bad Gateway errors">
    * Verify application is running in Qovery
    * Check that the CNAME points to the correct Qovery domain
    * Ensure Cloudflare IP ranges are whitelisted if using IP restriction
  </Accordion>
</AccordionGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Custom Domains" icon="globe" href="/configuration/application">
    Learn about custom domain configuration
  </Card>

  <Card title="SSL/TLS Certificates" icon="lock" href="/getting-started/security-and-compliance/overview">
    Understand SSL/TLS certificate management
  </Card>

  <Card title="Advanced Settings" icon="sliders" href="/configuration/service-advanced-settings">
    Configure advanced service settings
  </Card>

  <Card title="Networking" icon="network-wired" href="/configuration/integrations/api-gateway-nginx">
    Learn about networking and ingress
  </Card>
</CardGroup>
