Troubleshooting Critical CSS generation issues
Basic requirements for the generation tool to work:
- You must have a valid WP Rocket license.
- Check the service status here: https://wp-rocket.me/status/
- Your site must be publicly accessible for the tool to work, which means it won't work for locally hosted sites or sites blocked from the public by htaccess authentication, "maintenance mode" plugins or similar.
- The following IPs have to be allow listed by your server, firewall, or security plugin :
Cloudflare's Bot Fight Mode can prevent the Critical Path CSS (CPCSS) Generator from accessing your site.
Disable it and check if the CPCSS is generated:
- WP-cron or a real server-side cron job must be able to run.
Slow or no progress
If the generation appears to be running very slowly, i.e. it takes a long time for the progress indicator to update, it's likely that our tool is temporarily overloaded. In these cases it's best to try again in a few hours when the load may be lighter.
If it’s not possible for our tool to generate the critical path CSS for any content type on your site, you will see a notice with the details.
Some errors can be temporary, so it’s worth trying the generation again. If the issues persist, please proceed with the troubleshooting below.
If you get any error message on every content type (see screenshot below as an example), it’s likely our tool is being blocked by your site. Please make sure your site is publicly accessible and our IP addresses have been allowlisted in any security plugin or firewall.
Find which URL is accessed per content type
Our tool accesses the most recent URL for each content type on your site. If you see an error for a specific content type, you can find out which specific URL is being accessed:
- Install and activate this helper plugin: WP Rocket | CPCSS Debug Helper
- Go to: Settings > CPCSS Helper
- There you will see which URL we’re accessing for each content type
- Visit the problematic URLs to check if they are valid pages.
Invalid response code
Our external tool sends a request to a page on your site. If it does not receive a 200 “OK” response, you will see an error with the response.
The most common reasons are:
- The URL is not publicly accessible, e.g. it 404s
- A security layer on your site is blocking access - this often results in a 400 or 403 error.
cURL error 28
This is usually related to a security restriction from a plugin, a firewall or your host. Make sure that the IP addresses above are added to the relevant allow lists.
For further details about this error, please see this guide: cURL error 28
User has blocked requests through HTTP
External HTTP requests have been blocked on your site:
- Check your wp-config.php file for this line:
define( 'WP_HTTP_BLOCK_EXTERNAL', true );
- Check if a security plugin is blocking external HTTP requests
- Make sure you add this IP to your "allow list": 184.108.40.206
Job not found
- This is usually a temporary error. Please try the regeneration again in a few minutes.
This error notice will display the specific URL(s) that the tool cannot access.
- Visit the URL in your browser to ensure it’s accessible.
- If it is, it’s likely being blocked by a security firewall or plugin, so please allowlist our IPs.
- If the URL results in a 404 error, or any other error prevents it displaying in your browser, that means our tool will not be able to reach it either.
- Resolve the issue with that page and try the generation again.
- If it’s for a post type that has not been declared to be public, it will not work. Some post types are not designed to be visible on the front end of your website. For example, post types that manage affiliate links. A post type may be used to manage each link, but they are not viewable as a webpage since they redirect elsewhere.
No valid stylesheets available
You could see this message if:
- There aren’t any stylesheets added within <link> tags.
- The linked stylesheets are empty
- There’s only Inline CSS on your site. The tool does not use existing inline CSS when generating the critical path since it could result in duplicated CSS.
Styles contain one or more errors
- One of the recovered style sheets is invalid, preventing the generation of the critical path CSS.
- Check that your stylesheets are valid and accessible.
CloudFlare protection prevents the service from accessing the website
- Allowlist the IP addresses of our tool in Cloudflare (or any other similar firewall service)
An error prevents the generator from retrieving its contents
Sometimes this error can be temporary, try it again.
If the error persists it could be related to a timeout on the page:
- There’s a 30 second timeout on specific file requests
- There’s a 1 minute timeout on the page as a whole
The SSL certificate of the website is not valid so our service cannot access it.
- The port (80 or 443) is not open on the destination machine.
- The port (80 or 443) is open on the server, but its backlog of pending connections is full.
- A firewall is blocking access.
Too many redirections
If the duration between the request and the first byte (TTFB "Time To First Byte") exceeds 20 seconds the connection will be closed.