The Problem

Jetpack requires communication between WordPress.com servers and your self-hosted WordPress site via XML-RPC. When this communication fails, Jetpack features (stats, backups, CDN, etc.) stop working.

Symptoms

  • Jetpack shows "Connection lost" or "XML-RPC is not responding"
  • Stats do not update
  • Backup and security features fail
  • Jetpack setup wizard hangs at the connection step
  • "The Jetpack server could not communicate with your site"

Real Error Message

``` Jetpack::connection_check -> XML-RPC is not responding. Please make sure your site is not in maintenance mode and that XML-RPC is not blocked by a plugin or firewall.

Error: cURL error 28: Operation timed out after 5000 milliseconds ```

Common Causes

Cause 1: Firewall Blocking WordPress.com IPs

bash
# Jetpack servers connect from these IP ranges
# If your firewall blocks them, the connection fails

Cause 2: XML-RPC Disabled

Many security plugins disable XML-RPC, which breaks Jetpack.

How to Fix It

Fix 1: Verify XML-RPC is Accessible

```bash # Test XML-RPC from external curl -X POST https://example.com/xmlrpc.php \ -d '<methodCall><methodName>demo.sayHello</methodName></methodCall>'

# Should return: # <?xml version="1.0" encoding="UTF-8"?> # <methodResponse><params><param><value><string>Hello!</string></value></param></params></methodResponse> ```

Fix 2: Allow WordPress.com IPs in Firewall

```bash # Jetpack IP ranges (check Jetpack docs for current ranges) ufw allow from 192.0.64.0/18 to any ufw allow from 122.248.245.244 to any

# Or in iptables: iptables -A INPUT -s 192.0.64.0/18 -p tcp --dport 443 -j ACCEPT ```

Fix 3: Reconnect Jetpack via WP-CLI

```bash # Disconnect and reconnect Jetpack wp jetpack disconnect blog --user=1 wp jetpack register

# Or with token wp jetpack register --token=TOKEN ```

Fix 4: Fix SSL Certificate Issues

```bash # Verify SSL certificate curl -v https://example.com/xmlrpc.php

# If certificate is invalid, update it sudo apt update sudo apt install --reinstall ca-certificates

# Or temporarily disable SSL verification (NOT recommended for production) ```

php
// functions.php (temporary workaround only)
add_filter('https_ssl_verify', '__return_false');

Fix 5: Check for ModSecurity Rules

```bash # Check Apache error log for ModSecurity blocks grep "ModSecurity" /var/log/apache2/error.log

# If ModSecurity is blocking XML-RPC, add exception: # In ModSecurity config: # SecRuleRemoveById 949110 ```

Fix 6: Verify Site URL Settings

```bash # Ensure WordPress URL matches the actual URL wp option get siteurl wp option get home

# Both should return the same HTTPS URL # If they differ, fix them: wp option update siteurl 'https://example.com' wp option update home 'https://example.com' ```

Fix 7: Jetpack Debug Mode

```php // wp-config.php define('JETPACK_DEV_DEBUG', true); define('WP_DEBUG', true); define('WP_DEBUG_LOG', true);

// Then check debug.log for Jetpack-specific errors tail -f wp-content/debug.log | grep jetpack ```

Fix 8: Test Connection from WordPress.com Side

```bash # From your server, test outbound connection to Jetpack curl -v https://jetpack.wordpress.com/jetpack.testsite/1/

# Should return a valid response, not a timeout ```