GoAdmio

purge

Purge Cloudflare's entire edge cache for one domain or every hosted domain

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

/go/purge deletes everything Cloudflare has cached for a domain. Use it after you change a site's files, theme, or settings and visitors still see the old version because Cloudflare keeps serving its saved copy.

It looks up the domain's zone in your Cloudflare account and sends Cloudflare a "purge everything" request. You can purge one domain or every hosted domain.

The command uses the Cloudflare account ID and API token saved in GoAdmio's configuration, so the domain must already be in that Cloudflare account (see dns). The API token needs permission to purge the cache. The command raises its own privileges with sudo, so you can run it as any user with sudo rights.

[!NOTE] Right after a purge, the first visitors get fresh copies from your server, so the site can be slower and the server busier for a short time while Cloudflare refills its cache.

This clears Cloudflare's cache only. It does not clear the server's own caches or the caches in visitors' browsers.


Quick start

# Purge the Cloudflare cache of one domain
/go/purge example.com

Syntax

# One domain
/go/purge <domain>

# Every hosted domain
/go/purge all
Form Behavior
/go/purge <domain> Purges the cache of that domain, if it is hosted on this server.
/go/purge all Purges the cache of every domain that has a www folder under /home, one after another.

Every run is recorded in /var/log/go/purge.log, with the time and the arguments you passed.


Options

Argument Required Notes
domain Yes A hosted domain with a /home/<domain>/www folder, or all.

Output

For each domain the command prints a progress line, then Cloudflare's reply as raw text.

[1/20] Purge Everything for example.com...
{"result":{"id":"<id>"},"success":true,"errors":[],"messages":[]}
Line Meaning
[<n>/<total>] Purge Everything for <domain>... The domain being purged. With a single domain, the numbers are blank and the line reads [/] Purge Everything for <domain>.... This is cosmetic.
"success":true Cloudflare accepted the request.
"success":false with an errors list Cloudflare refused the request. The error text says why.

The command does not read Cloudflare's reply, so it always finishes the same way whether or not the purge worked. Check the reply for "success":true.

If the domain isn't hosted on this server (no /home/<domain>/www folder), the command prints nothing.

Log

Each run appends one line to /var/log/go/purge.log:

[Nov 21 12:00:00]# purge example.com

Examples

# Purge one domain
/go/purge example.com
# Purge every hosted domain
/go/purge all

Troubleshooting

Symptom Likely cause Fix
Nothing is printed /home/<domain>/www doesn't exist, so the domain isn't hosted here. For all, there are no hosted domains. Check the domain name.
"success":false with an authentication error The saved API token or account ID is missing, wrong, or lacks permission to purge the cache. Check the Cloudflare settings in GoAdmio and the token's permissions in Cloudflare.
"success":false with an error about the zone or the route The domain isn't in the Cloudflare account, so no zone was found. Add it with dns, then run again.
Some domains fail during all Cloudflare may limit how often cache purges are accepted. Wait a little, then purge the failed domains one at a time.
The site still shows old content The old copy comes from a browser or a server-side cache, not from Cloudflare. Reload the page without its cache, or clear the site's own caches.
The site is slow just after a purge The cache is empty and refilling. Expected. It recovers as visitors request pages.

Details

What it does for each domain

Step Action
1 Checks that /home/<domain>/www exists.
2 Looks up the domain's zone ID in the Cloudflare account.
3 Sends Cloudflare a purge_everything request for that zone.

With all, the command goes through every entry in /home and runs these steps for each one that has a www folder.

flowchart TD
    A["purge domain or all"] --> B["Raise privileges with sudo, log the run"]
    B --> C["Read the Cloudflare account ID and API token"]
    C --> D{"all?"}
    D -- "Yes" --> E["For each /home entry with a www folder"]
    D -- "No" --> F{"/home/domain/www exists?"}
    F -- "No" --> X["Nothing happens"]
    F -- "Yes" --> G["One domain"]
    E --> H["Find the zone ID"]
    G --> H
    H --> I["Send the purge everything request, print Cloudflare's reply"]

See also

Command Description
cloudflare Configure Cloudflare DNS records, SSL, caching, and security settings for one or all hosted domains through the Cloudflare API
dns Add one or all hosted domains to Cloudflare and set up their DNS zone, proxy and cache mode, nameservers, and SSL
proxy Turn Cloudflare proxying on or off for a domain's main DNS records, or re-apply the saved setting, for one domain or all
securitylevel Set the Cloudflare security level for a domain or all hosted domains
underattack Enable Cloudflare Under Attack Mode for a domain