403 Forbidden When Activating License Key

Some of our users encounter a 403 forbidden error message when activating their license key.

This issue is caused by a lack of communication between their server and ours, usually due to a firewall.

If you’re encountering this error, please try the following debugging steps.

Secondary API

The first thing to try is using the secondary API that we built specifically to tackle this issue.

To use it, add the following function to you site (Adding PHP):

add_filter( 'pre_http_request', function( $pre, $args, $url ) {
    if ( 'https://generatepress.com' === $url || 'https://generatepress.com/' === $url ) {
        return wp_remote_post(
            'https://api.generatepress.com',
                array(
                    'timeout' => $args['timeout'],
                    'sslverify' => $args['sslverify'],
                    'body' => $args['body'],
                )
        );
    }
	
    return $pre;
}, 10, 3 );

Enabling cURL

If the above doesn’t work, the next thing to check is whether your server has the curl extension installed, as it’s required for this to work.

To check, go to “Tools > Site Health”. If it’s not installed or enabled, it will show up like in the below screenshot.

The curl module is not installed or has been disabled

If this is the case, contact your hosting support and ask them to install it on your server.

Firewalls

If cURL isn’t the issue, it’s likely a firewall issue. This is more complicated, but can usually be resolved by going through the following steps.

  1. If you’re using Cloudflare, please switch your domain to DNS-only and try activating your license key again. If this fixes the issue, it means your Cloudflare firewall is blocking communication with our server.
  2. If you’re not using Cloudflare, ask your hosting support if your server has a firewall built in, and ask them to temporarily deactivate it while you try to activate your license key.
  3. The same goes for if you’re using a firewall WordPress plugin. Try deactivating it to see if it’s the cause of the error.

If doing this fixes the issue, please add our IP address to your allow-list so you can turn your firewall back on: 162.159.135.42

If you’ve confirmed that the block is not happening on your end, please follow these instructions:

1. Turn on WP_DEBUG and WP_DEBUG_LOGhttps://wordpress.org/support/article/debugging-in-wordpress/
2. Add this function (Adding PHP) to your site:

add_action( 'http_api_debug', function( $response, $context, $class, $r, $url ) {
	if ( 'https://generatepress.com' !== $url && 'https://api.generatepress.com' !== $url ) {
		return;
	}

	error_reporting( error_reporting() & ~E_NOTICE );
	error_log( '------ Start GeneratePress license key debugging ------' );
	error_log( '--- HTTP response or WP_Error object. ---' );
	error_log( print_r( $response, true ) );
	error_log( '--- HTTP transport used. ---' );
	error_log( $class );
	error_log( '--- HTTP request arguments. ---' );
	error_log( print_r( $r, true ) );
}, 10, 5 );

3. Try to activate the license key again
4. Go to wp-content/debug.log and share the debugging information with us by opening a support topic in our support forums. Feel free to share any sensitive information in the Private Information field when opening your topic.