To enable "Cache Everything" on Cloudflare for static content like images, follow these steps:
Log into Cloudflare
Go to the Cloudflare dashboard and select your website.
Create a Page Rule
In the left-hand menu, click on "Rules" and then select "Page Rules".
Add a New Page Rule
Click on "Create Page Rule".
Define the URL Pattern
In the "If the URL matches" field, specify the URL pattern that should match your static content. For example, to cache all images (typically under /wp-content/uploads), use something like:
*example.com/wp-content/uploads/*
Replace example.com with your actual domain.
Set Cache Everything
Under "Then the settings are", choose "Cache Level" from the dropdown and select "Cache Everything".
Add Edge Cache TTL (Optional)
Optionally, you can set an Edge Cache TTL to define how long Cloudflare caches the content before checking for updates. This is particularly useful for static assets like images. Choose a suitable duration (e.g., 1 month or longer for images).
Save and Deploy the Rule
Click "Save and Deploy".
Test the Configuration
After deploying, check a few pages on your website to ensure that images are being cached correctly by reviewing the headers (look for cf-cache-status: HIT).
This setup will ensure Cloudflare caches your images and other static content, reducing the need for constant requests to your origin server or S3 bucket.