SiteGround blocks Used CSS generation
This guide helps WP Rocket users understand and try to resolve issues when SiteGround is blocking the Used CSS generation for the Remove Unused CSS feature.
The information also applies to the Critical Path CSS generation for the Load CSS asynchronously feature.
Problem description
When affected by this situation, your SiteGround sites don't have their CSS optimized as expected, and PageSpeed/GTmetrix reports still show render-blocking CSS. You've tried restarting the Used CSS generation and waiting to retry without success.
This happens because the SiteGround host uses some firewall, security, and rate-limiting features to block malicious activity. These features mistake the WP Rocket servers as malicious bots. Your site will show a captcha challenge instead of its real content, and the Used CSS generation will fail.
Because of the many potential configurations and limits of the SiteGround security features, combined with the regular Used CSS generation challenges, the problem will appear almost on a random basis. This makes it very difficult to know when a site is being impacted, when a workaround actually helped, or if the issue will come back.
Workarounds
From experience, it's sometimes possible to resolve this by the combination of the following actions:
- Ask SiteGround support to allow the relevant WP Rocket IPs or User Agents.
- Request their support team to disable the problematic
mod_securityrules from their firewall. - Ask to disable SiteGround's AntibotAI system.
- Install the WP Rocket | Change Parameters to reduce the requests and potentially avoid SiteGround mistaking WP Rocket requests with malicious activity.
- Avoid clearing the Used CSS unnecessarily to reduce new requests from constantly being queued, and blocked.
Unfortunately, the above actions do not permanently resolve the issues.
Advanced detection and workarounds
If you're comfortable navigating the WordPress site database, you can detect these issues by:
Checking the wp_wpr_rucss_used_css table and seeing if you can find:
- Error messages like:
Execution context was destroyed, most likely because of a navigation,RUCSS: shakedCSS size is less than 150,Navigation timeout of 45000 ms exceeded,Unexpected exit code: null signal: SIGTRAP.
- The jobs' next retry time value is set to
0000-00-00 00:00:00. - URLs or jobs stuck in a certain status after several minutes or hours.
Or, checking the wp_actionscheduler_actions table and:
- Not seeing any
rocket_saas_job_check_statusactions.
After trying the regular workarounds, some advanced techniques to try to improve the Used CSS generation include:
- Truncating the
wp_wpr_rucss_used_csstable.
Limitations
Even if the different workarounds have been applied, SiteGround sites might still experience issues in the Used CSS generation at certain moments in the future.
Unfortunately, the WP Rocket support team can't help with those cases. The blockage is done solely on SiteGround's end, and only they can help.