• Resolved dev

    (@devksec)


    Hello,

    So we have Total cache setup on a multisite installation. Two of the subsites use a similar font pack mandated by their theme. All files are uploaded to a cloudfront CDN loaded from an S3 bucket (setup in total cache).

    On one of the subsites, a key font regularly gets a CORS errors while all of the other fonts are fine. Normally we have to purge that one font from the CDN to resolve however it keeps coming back.

    Now when we try to clear the font we get the following error: Not a valid retry configuration argument.

    How can we resolve this issue with the font CORS problem ?

    Many thanks

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter dev

    (@devksec)

    Actually this looks like a more widespread issue with the CDN.

    All of our upload queues have the same error.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @devksec

    I am sorry about the issue you are experiencing and I am happy to assist you with this.
    Can you please share the website URL on which you are seeing these erros.
    The option “Add CORS header” needs to be enabled in Performance>CDN>Advanced.
    You also need to make sure to set the CORS configuration on AWS so please follow the instructions on this link.
    Also, make sure to add the following rule at the top of the .htaccess:

    # Set CORS
    <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css)$">
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
    </IfModule>
    </FilesMatch>
    # Set CORS

    I hope this helps!
    Thanks!`

    Thread Starter dev

    (@devksec)

    Hello,

    Thanks again for your support!

    The font URL is: https://cdn2.ksec.co.uk/wp-content/fonts/inter/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hjp-Ek-_0ew.woff
    I’ve managed to temp fix this by clearing the CDN cache again.

    The CORS header is configured and works for every other file in the CDN, including WOFF fonts. The CDN behaviour link references the legacy cache settings in AWS. Does total cache support the updated “cache policy and origin request policy” instead of legacy?

    We have the following in our .htaccess:

    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
    </IfModule>

    We’re still getting “Error: Not a valid retry configuration argument.” when trying to test the CDN config & upload anything to the S3 CDN.

    Many Thanks

    Thread Starter dev

    (@devksec)

    The “Not a valid retry configuration” seems to be generated fromthe AWS SDK code “ConfigurationProvider.php”

    * Unwraps a configuration object in whatever valid form it is in,
    * always returning a ConfigurationInterface object.
    *
    * @param mixed $config
    * @return ConfigurationInterface
    * @throws \InvalidArgumentException
    */
    public static function unwrap($config)
    {
    if (is_callable($config)) {
    $config = $config();
    }
    if ($config instanceof PromiseInterface) {
    $config = $config->wait();
    }
    if ($config instanceof ConfigurationInterface) {
    return $config;
    }

    // An integer value for this config indicates the legacy ‘retries’
    // config option, which is incremented to translate to max attempts
    if (is_int($config)) {
    return new Configuration(‘legacy’, $config + 1);
    }

    if (is_array($config) && isset($config[‘mode’])) {
    $maxAttempts = isset($config[‘max_attempts’])
    ? $config[‘max_attempts’]
    : self::DEFAULT_MAX_ATTEMPTS;
    return new Configuration($config[‘mode’], $maxAttempts);
    }

    throw new \InvalidArgumentException(‘Not a valid retry configuration’
    . ‘ argument.’);
    }

    It looks like it started 19 days ago and the S3 CDN no longer works.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @devksec

    Thank you for the information.
    The AWS library version 3.183.0 was updated in the latest 2.1.3 version of W3 Total Cache 3 weeks ago.
    Can you please share the PHP version you are using?
    Thanks!

    Thread Starter dev

    (@devksec)

    We’re using version 7.4.16 currently

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @devksec

    Thank you for the information.
    Please try to re-authorize the CDN and see if the issue persists. I’ll try to replicate the issue.
    YOu might want to try upgrading the PHP to 8.0
    Thanks!

    Thread Starter dev

    (@devksec)

    So we cannot authorize it at all as that error is produced when trying to “Test S3 upload & Cloudfront distribution”.

    We’ve even tried new keys but it seems that the AWS config isn’t being accepted by the AWS SDK.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @devksec

    Just to confirm, this happens only on a single subsite?
    Are you referring to: vendor/aws/aws-sdk-php/src/Retry/ConfigurationProvider.php?
    Thanks!

    Thread Starter dev

    (@devksec)

    So this is with a multisite setup and they’re all using the same config.

    Yes thats correct

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @devksec

    Thank you for the information.
    Seems there is some kind of issue with the CDN configuration (On the AWS before trying to connect with W3TC)
    Can you please double-check the config and try creating a new bucket?
    Thanks!

    Thread Starter dev

    (@devksec)

    So we’ve setup the CDN + S3 to default however still getting the same error when trying to test access.

    Not sure if there is some issue with the Total cache config ?

    Thread Starter dev

    (@devksec)

    This looks like its being caused by a conflict with WP-Activity logger … Disabling the plugin resolves the issue.

    I’ve raised this with their dev team.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @devksec

    Thank you for the information.
    So it seems that is a Library conflict with the other plugin.
    You can force W3TC not to load its own copy by adding:
    define('W3TC_SKIPLIB_AWS', true);
    I hope this helps!

    Thread Starter dev

    (@devksec)

    Hello,

    Unfortunately this does not resolve the issue. I then get the following error:

    [Fri Jun 18 17:54:18.421544 2021] [proxy_fcgi:error] [pid 11425:tid 140027677865728] [client 172.69.54.15:44174] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Class 'Aws\\S3\\S3Client' not found in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/CdnEngine_S3.php:107\nStack trace:\n#0 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/CdnEngine_S3.php(369): W3TC\\CdnEngine_S3->_init()\n#1 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/CdnEngine_CloudFront.php(171): W3TC\\CdnEngine_S3->test()\n#2 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/Cdn_AdminActions.php(428): W3TC\\CdnEngine_CloudFront->test()\n#3 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/Root_AdminActions.php(25): W3TC\\Cdn_AdminActions->w3tc_cdn_test()\n#4 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/Generic_Plugin_Admin.php(165): W3TC\\Root_AdminActions->execute()\n#5 /opt/bitnami/apps/wordpress/htdocs/wp-includes/class-wp-hook.php(292): W3TC\\Generic_Plugin_Admin->load()\n#6 /opt/bitnami/apps/wordpress/htdocs/wp-includes/class-wp-hook.ph...', referer: https://SITE.uk/wp-admin/network/admin.php?page=w3tc_cdn
    [Fri Jun 18 17:54:57.605547 2021] [proxy_fcgi:error] [pid 7238:tid 140026503378688] [client 172.69.54.15:46560] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Class 'Aws\\S3\\S3Client' not found in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/CdnEngine_S3.php:107\nStack trace:\n#0 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/CdnEngine_S3.php(369): W3TC\\CdnEngine_S3->_init()\n#1 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/CdnEngine_CloudFront.php(171): W3TC\\CdnEngine_S3->test()\n#2 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/Cdn_AdminActions.php(428): W3TC\\CdnEngine_CloudFront->test()\n#3 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/Root_AdminActions.php(25): W3TC\\Cdn_AdminActions->w3tc_cdn_test()\n#4 /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/w3-total-cache/Generic_Plugin_Admin.php(165): W3TC\\Root_AdminActions->execute()\n#5 /opt/bitnami/apps/wordpress/htdocs/wp-includes/class-wp-hook.php(292): W3TC\\Generic_Plugin_Admin->load()\n#6 /opt/bitnami/apps/wordpress/htdocs/wp-includes/class-wp-hook.ph...', referer: https://SITE.uk/wp-admin/network/admin.php?page=w3tc_cdn
Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Font CDN issue’ is closed to new replies.