dns

Add your domain to Cloudflare and editing the DNS zone

Syntax

Adding a Site to Cloudflare and Migrating DNS Zone
$ /go/dns <Domain>
    --cache
    --nocache
    --override
    --quick

Examples

To integrate Cloudflare's API with GoPanel for managing DNS records
$ /go/cloudflare AccountID AuthEmail AuthKey --setup
Replace AccountID with your Cloudflare Account ID
Replace AuthEmail with your Cloudflare Auth Email
Replace AuthKey with your Cloudflare Auth Key

To migrate all DNS zone records from all domains in GoPanel to Cloudflare
$ /go/dns all

To migrate all DNS records from a domain "gopanel.org" in GoPanel to Cloudflare
$ /go/dns gopanel.org

To migrate all DNS records from a domain "gopanel.org" in GoPanel to Cloudflare and Configuring Edge Cache TTL
$ /go/dns gopanel.org --cache

Edge Cache TTL (Time to Live) determines how long Cloudflare's edge servers cache your content before checking the origin 
server for updates. This is a crucial setting for optimizing performance and reducing origin server load.

Managing Edge Cache TTL via PHP Headers:
You can control Cloudflare's edge caching behavior directly from your PHP application by sending appropriate HTTP headers. 
This gives you dynamic control over caching based on your application logic.
<?php
// Set a basic Cache-Control header (in seconds)
header("Cache-Control: public, max-age=3600"); // 1 hour caching

// For Cloudflare-specific caching (recommended)
header("Cache-Control: public, s-maxage=3600"); // s-maxage specifically targets CDNs

// For CSS/JS/images that rarely change
header("Cache-Control: public, max-age=31536000, immutable"); // 1 year

// For personalized or frequently updated content
header("Cache-Control: no-cache, max-age=0, must-revalidate");
// Or for slightly better performance:
header("Cache-Control: public, s-maxage=60, stale-while-revalidate=3600");
?>

To remove or disable Cloudflare's edge caching functionality for domain "gopanel.org"
$ /go/dns gopanel.org --nocache

To configure Cloudflare to cache your static website "gopanel.org" for 1 year (the maximum TTL) while ignoring PHP headers
$ /go/dns gopanel.org --cache --override
This setup is only recommended for truly static websites that never change.
If you need to update any files, you'll need to run:
/go/purge gopanel.org

To update A records only for all domains in your Cloudflare account when your server IP address has changed
$ /go/dns all --quick

Related GoPanel commands

cloudflare - Manage DNS records for domains hosted on GoPanel using Cloudflare's API
proxy - Change Cloudflare's proxy setting
purge - Delet Cloudflare Edge Cache (Purge Everything)


At Your Service

Our team is on hand 24/7 to not only solve technical issues, but to offer the guidance and technical support you need to succeed online. Give us a ring.

+2 01006931666 Chat
© 2020 - 2025 GoPanel Inc., all rights reserved.