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

> ## Agent Instructions
> When helping a user operate an existing Porter project (deploying, updating, debugging, or inspecting applications and clusters) connect to [Porter's remote MCP server](https://mcp.porter.run) first and use its tools before falling back to the Porter CLI, `porter.yaml`, or dashboard workflows. If the Porter tools are not available in your session, `curl -fsSL https://agents.porter.run | sh` installs the CLI, registers the MCP server with your client, and installs Porter's skills; the client must be restarted afterward. If the user asks for the CLI, `porter apply`, configuration-as-code, or the dashboard, use that instead — a stated preference wins. Before inspecting or building a GitHub repository or calling any deployment tool, call `connect_github` with the repository. Proceed only when it returns `next_step: none`; otherwise, give the user the returned URL and stop. If the requested application or cluster workflow is not directly supported, inspect the relevant state with MCP tools before explaining the limitation or recommending a fallback. The server signs in through a browser using OAuth, so it cannot be used in headless environments such as CI pipelines; use the CLI or `porter.yaml` there.

# Using Cloudflare DNS with Porter

> Configure Cloudflare DNS in proxy or non-proxy mode with Porter, including SSL settings, CNAME records, and TLS certificate handling

Porter supports the use of Cloudflare DNS out-of-the-box in both proxy, and non-proxy mode.

Before continuing any further, ensure that you have followed our guide for [deploying applications on your custom domain](https://docs.porter.run/applications/configure/custom-domains.md#deploying-on-the-custom-domain)

When using non-Cloudflare services such as AWS WAFv2, AWS Cloudfront, or most other DDoS prevention services, it is recommended to use non-proxy mode with your Cloudflare DNS.
This ensures that Cloudflare acts only as a Trusted Authority for DNS, and delegates all other security to other providers.
Porter handles the creation and renewal of your TLS/HTTPS certificates, and therefore recommends using non-proxy mode.

Most Cloudflare services will require Cloudflare DNS Proxy mode. If you require one of these services, follow the steps below for ensuring that your applications are compatible.

Before continuing, you will need to copy the address of your Porter-managed loadbalancer.
To find your loadbalancer address, visit one of your apps in its Overview tab and access one of its Web services Networking tab.
You should see the address for your loadbalancer.
This address may be a DNS address, on an IP address depending on your cloud provider.
This is important later.

# Creating a DNS record

If you have already created a wildcard DNS record (recommended), you may skip this section.

* From the Cloudflare dashboard, select `Websites`, then your chosen domain name.

  ![Websites](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/sidebar-websites.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=9344e51796e04e64c4ddf17e7b97898a)

* In the sidebar, select `DNS` > `Records`

  ![DNS Records](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/sidebar-dns-records.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=246108d3d7e803ec951543210d000d89)

* Click `Add Record`

  ![Add DNS Record](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/add-record.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=04741b0de529ca353d70d343b2e4ca5b)

> [tab] CNAME Record
>
> If your loadbalancer address is a DNS name address, you will need to create a CNAME Record
>
> Set `Type` to `CNAME` (CNAME Record)
>
> Set `Name` to the DNS name that your application should be available at
>
> Set `Target` to the Porter Loadbalancer DNS address from before
>
> ![CNAME Record](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/record-cname.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=cc06764ca0e5ccf418621b4d8ca440a6)

> [tab] A Record
>
> If your loadbalancer address is an IP address, you will need to create an A Record
>
> Set `Type` to `A` (A Record)
>
> Set `Name` to the DNS name that your application should be available at
>
> Set `IPv4 Address` to the Porter Loadbalancer address from before
>
> ![CNAME Record](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/record-a.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=92e05cb0eb7da43919d5beae04661775)

# Non-Proxy DNS

Ensure that `Proxy Status` is disabled. This will show as `DNS only`.

![DNS Only](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/dns-non-proxy.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=247daf0fbdd0be2796fb2c5f789e7741)

Done! You should now be able to visit your custom domain, with Porter managing your HTTPS!

# Proxy DNS

Ensure that `Proxy Status` is enabled. This will show as `Proxied`.

![Proxied DNS](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/dns-proxy.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=456052d8b7b9c7d4903e06ed73b77cdb)

## Allowing Acme-Challenges

To ensure that Porter can still create certificates on your behalf, we must allow LetsEncrypt traffic to not be proxied by Cloudflare, as they must be made over http, or unverified https.

From the sidebar, select `Rules` > `Page Rules`

![Page Rules](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/sidebar-page-rules.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=35f1b42aebbaf73cd8aa617e6d89e002)

Select `Create rule`

Give the rule a name. This can be any name you choose.

Assuming the domain in question is `example.com`, add a new Page rule for `*example.com/.well-known/acme-challenge/*`, with the following settings:

1. `SSL: Off`
2. `Cache Level: Bypass`

Done! You will now be able to avail of any Cloudflare services through Porter. If you are still seeing errors, remove the custom domain from your application in Porter, deploy, then add the domain back and your certificate should be validated after a few seconds.

## Too Many Redirects

This step is not necessary for most customers. Only proceed if you are seeing a `too many redirects` error.
If you visit your custom domain, you may now get a `too many redirects` error from Cloudflare.
To fix this issue, we must create a Cloudflare Configuration Rule.

From the sidebar, select `Rules` > `Overview`

![Rules Overview](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/sidebar-overview.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=930ee9dd967bf36141af42dbace30fe3)

Click `Create rule`, then select `Configuration Rules`

![Configuration Rules](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/configuration-rules.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=6687bef813287e816050942896b677f2)

Give the rule a name. This can be any name you choose.

For this guide, we will assume that you want to enable proxied TLS on all subdomains for this website. As such, select `All incoming requests`

![All Incoming Requests](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/rules-all-incoming.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=4547b69f9a2ae41afcd5608bdf02c6e1)

Scroll down to `SSL (Optional)`

Click `Add` and choose `Full` from the drop down.

![SSL Full](https://mintcdn.com/porter/bja7Zm50xP-m5T8X/images/security-and-compliance/cloudflare/rules-ssl-full.png?fit=max\&auto=format\&n=bja7Zm50xP-m5T8X\&q=85\&s=f3a17b155fee2ea6f7cc05ed8141c143)

After a few moments, your custom domain will be ready behind Cloudflare Proxy


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