BoldGrid / w3-total-cache

GNU General Public License v2.0
151 stars 81 forks source link

Cannot use DigitalOcean Spaces as CDN (S3) Compatible #243

Open mavas84 opened 3 years ago

mavas84 commented 3 years ago

The DigitalOcean Spaces cannot be used as CDN push Amazon Simple Storage Service (S3) Compatible

Reference topic: https://wordpress.org/support/topic/cannot-use-digitalocean-spaces-as-cdn/ https://wordpress.org/support/topic/problems-with-digitalocean-spaces-use-as-cdn/

watou commented 3 years ago

Just to add that I pushed successfully to a genuine Amazon AWS S3 bucket with the CDN Type "Amazon Simple Storage Service (S3)" and it did upload the file wp-includes/css/dashicons.min.css.gzip (and all other .gzip minified CSS/JS) resulting in a working CDN setup. But in contrast, using the CDN Type "Amazon Simple Storage Service (S3) Compatible" to DigitalOcean Spaces, I repeatedly received 411 errors on uploading assets, etc. However it appeared to retry successfully and upload the files, but never any success for the minified CSS/JS ".gzip" files. So of course the site would be broken with the browser getting 403 errors trying to access the nonexistent .gzip files.

julianbrez commented 3 years ago

Same

watou commented 3 years ago

Is there documentation on the purpose of the BACKLOG project this issue was immediately added to? I did look and wonder if this is effectively the same as "wontfix". Thanks!

kamushadenes commented 3 years ago

Any news on this? @mavas84

mavas84 commented 3 years ago

Hello @kamushadenes

Thank you for your inquiry about this. The devs are still working on this as it needs a lot of testing and there are other tickets and big updates that we need to focus on at the moment. I am sorry for the delay and hopefully, this will be fixed soon. Thanks!

AmibeWebsites commented 3 years ago

Hi @mavas84, thank you for your response to that question. I imagine there are a few of us wondering about this and also open to assisting with testing if that could support.

mavas84 commented 2 years ago

Another issue was reported. S3 Compatible CDN not working with VULTR.com Object Storage Error: Unable to put object (S3Compatible::putObject(): [411] Unexpected HTTP status). https://github.com/W3EDGE/w3-total-cache/issues/397

mavas84 commented 2 years ago

Another reported issue https://github.com/W3EDGE/w3-total-cache/issues/473

Selected Amazon S3 Bucket Compatible, added the configuration:

Api host: ams3.digitaloceanspaces.com
Access key: ****
Secret key: ****
Bucket: cdn.mydomain.com
SSL support: Always use SSL
Replace site's hostname with: cdn.mydomain.com

In DigitalOcean I've generated a ssl certificate for cdn.mydomain.com subdomain, and the name of the bucket in DO is cdn.mydomain.com.

And testing S3 cdn configuration receiving this:

Error: Unable to put object (S3Compatible::putObject(): [60] SSL: no alternative certificate subject name matches target host name 'cdn.mydomain.com.ams3.digitaloceanspaces.com'). PS: On my domain server I'm using apache and I have generated ssl certificate available only for mydomain.com and www.mydomain.com.

And cdn.mydomain.com is a dns CNAME ALIAS for cdn.mydomain.com.ams3.digitaloceanspaces.com.

some findings:

JayPanchani1054 commented 1 year ago

Any Updates? I want to host minified CSS & js files on Digital Ocean spaces.

image

vskarleas commented 1 year ago

Same problem here

mavas84 commented 1 year ago

Another related issue to S3 Compatible: https://wordpress.org/support/topic/s3-compatible-cdn-confirmation-not-working/

AmibeWebsites commented 1 year ago

Anyone have any idea if the recently announced changes to DigitalOcean Space has any bearing on this issue?

unaibamir commented 11 months ago

Having same problem. Did anyone find solution for this?

virgial commented 9 months ago

I've personally have a working version for now with a Digital Ocean Spaces bucket. I found out that the CdnEngine_S3_Compatible class in the plugin is missing the possibility to add a custom region. When hardcoding the necessary region, all connections are working. For a good working solution, I suggest to add the region option in the WordPress w3 total cache CDN settings by the developers. Below a code snippet with the added region. See the fixed region: 'ams3' part in the constructorfunciton in class CdnEngine_S3_Compatible: `function __construct( $config = array() ) { $config = array_merge( array( 'key' => '', 'secret' => '', 'bucket' => '', 'cname' => array(), ), $config );

    $this->_s3 = new \S3Compatible( $config['key'], $config['secret'], true,
        $config['api_host'], 'ams3' );
    $this->_s3->setSignatureVersion( 'v2' );

    parent::__construct( $config );
}`