Powered Cache Cloudflare Extension is designed to enhance your website’s performance and security when using Cloudflare as a CDN (Content Delivery Network). This extension offers key features such as restoring the real IP address of your users, purging the Cloudflare cache directly from your website, and securely handling your Cloudflare API credentials.
Setting Up API Credentials
To interact with Cloudflare’s API for features such as cache purging, you need to define your API key and token within your website’s configuration. Follow the steps below to securely set up your Cloudflare API credentials:
Obtain API Token from Cloudflare:
- Log in to your Cloudflare account.
- Navigate to the ‘My Profile’ section.
- Find your API keys and create a token with the necessary permissions.
Simply visit https://dash.cloudflare.com/profile/api-tokens to access your token.
Powered Cache also supports the usage of Global API Keys; however, this is considered legacy, and we will eventually remove this feature. Therefore, it is advisable to use API Tokens wherever possible, particularly for security reasons.
Enter Your Details
Once you have enabled Powered Cache’s Cloudflare extension, you will need to enter either your API Token and Zone or your email address and API Key. Once you have entered one of these options, save your changes.
Define API Credentials in wp-config.php:
Cloudflare API credentials must be treated as sensitive information, so we encrypt them when saving them in your database. Alternatively, you can define your API Key or API Token in your configuration file.
To do this, access your website’s wp-config.php file, usually located at the root of your WordPress installation.
Safely insert the following lines of code, replacing ‘YOUR-API-KEY’ and ‘YOUR-API-TOKEN’ with your actual Cloudflare API key and token respectively:
define( 'POWERED_CACHE_CF_API_KEY', 'YOUR-API-KEY' );
define( 'POWERED_CACHE_CF_API_TOKEN', 'YOUR-API-TOKEN' );
Please remember, when you export Powered Cache settings, this information will not be included in the export file. You will need to configure this information for each website individually or use definitions in your configuration file.