• Hello,

    I am trying to setup DigitalOcean as my CDN provider. I have set the correct API host, access and secret key, bucket, cname but i got an error that did not divulge much – something with 411 which made me debug things.

    If we look at https://developers.digitalocean.com/documentation/spaces/#object it seems that we need to send a mandatory Content-Length in the headers.

    If we don’t specify it we end up with the error in the response

    object(stdClass)#2126 (4) {
    [“error”]=>
    bool(false)
    [“body”]=>
    string(222) “<?xml version=”1.0″ encoding=”UTF-8”?><Error>MissingContentLength<BucketName>xxx-yyy</BucketName><RequestId>xxx-yyy-zzz-www</RequestId><HostId>aaa-bbb-ccc</HostId></Error>”

    Looking inside code in class S3Compatible line ~452 it is specified that we should set “Content-Length” but that is not done.

    Theoretically all that we need to do is to set
    $rest->setHeader(‘Content-Length’, $rest->size);

    Once this is done things become even stranger, as now the response hangs for aprox 1 minute then return the error

    object(stdClass)#2126 (4) {
    [“error”]=>
    bool(false)
    [“body”]=>
    string(214) “<?xml version=”1.0″ encoding=”UTF-8”?><Error>UnknownError<BucketName>xxx-yyy</BucketName><RequestId>xxx-yyy-zzz-qqq</RequestId><HostId>aaa-bbb-ccc</HostId></Error>”
    [“headers”]=>
    array(3) {
    [“size”]=>
    int(214)
    [“type”]=>
    string(15) “application/xml”
    [“date”]=>
    int(1562697356)
    }
    [“code”]=>
    int(500)
    }
    {“result”:false,”error”:”Error: Unable to put object (S3Compatible::putObject(): [500] Unexpected HTTP status).”}

    Please let me know what i am doing wrong.

    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    Just to confirm, have you selected the Origin Push: Amazon Simple Storage Service (S3) Compatible from the CDN dropdown?

    Thread Starter zenontech

    (@zenontech)

    Hello,

    That is correct, i have selected “AMazon Simple Storage Service (s3) Compatible”.

    Thread Starter zenontech

    (@zenontech)

    Hello,

    Any ideas on this?

    Thanks!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    Sorry for the late reply.
    I spoke with the team and apparently, this is an issue on our side. I’ve created a ticket and this will be fixed in future releases.

    Thread Starter zenontech

    (@zenontech)

    Hello,

    No problem, will wait for the fix but to speed things up can i help you with further details or test cases or credentials or something else ?

    Thanks!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    No need for that. Thanks for bringing this to our attention. We will be working on a fix.

    Thread Starter zenontech

    (@zenontech)

    Hello,

    It does not work, when testing the CDN it just says “Test failed”.

    So i have looked inside the code and saw that the developers have added the $rest->setHeader('Content-Length', $rest->size); but the second problem persists – after 30 seconds DO returns UnknownError

    Output of $rest->getResponse(); from S3Compatible class:

    
    object(stdClass)#2116 (4) {
      ["error"]=>
      bool(false)
      ["body"]=>
      string(229) "<?xml version="1.0" encoding="UTF-8"?><Error><Code>UnknownError</Code><BucketName>my-bucket-name</BucketName><RequestId>tx000000000000013ab07df-005d46757b-1c0f65-fra1a</RequestId><HostId>myHostID-fra1a-fra1</HostId></Error>"
      ["headers"]=>
      array(3) {
        ["size"]=>
        int(229)
        ["type"]=>
        string(15) "application/xml"
        ["date"]=>
        int(1564898713)
      }
      ["code"]=>
      int(500)
    }

    Do you need anything from my side?

    • This reply was modified 5 years, 3 months ago by zenontech.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @zenontech,
    Thank you for your inquiry. This is not fixed yet. We’ve added an issue for this and we are working on a fix.
    Thank you for your patience.

    Thread Starter zenontech

    (@zenontech)

    Hello,

    Ok, please let me know once this has been fixed.

    Thanks!

    Thread Starter zenontech

    (@zenontech)

    Hello,

    This is marked as fixed but it does not work, at least for me it doesn’t as i still get Error: Unable to put object (S3Compatible::putObject(): [411] Unexpected HTTP status).

    jbdynamics

    (@jbdynamics)

    So the 411 error codes from DigitalOcean Spaces (S3 Compatible) for a missing content-length header is still an issue, when I try to upload the media library, wp-includes, theme files and custom files, for every item I get:

    Unable to put object (S3Compatible::putObject(): [411] Unexpected HTTP status).

    However, after the error it then says Object up-to-date and the files appear to be uploading. It would be nice to not have all the error messages, but I guess it works for the most part.

    Thread Starter zenontech

    (@zenontech)

    Hello,

    I confirm that now when testing the bucket on w3total cache i get the error:
    Error: Unable to put object (S3Compatible::putObject(): [411] Unexpected HTTP status). but the files are uploaded.
    As i don’t want others to lose time when trying to setup i have the following setup:

    API host: fra1.digitaloceanspaces.com
    Access key ID: my-key-from-do
    Secret key: secret-key-generated-from-do
    Bucket: bucket-name-from-do
    SSL support: auto

    do = digital ocean

    So it seems fine but there is a problem: although i have checked to have files minified when reviewing the network tab both the css and js minified files are server from both cdn and site url, do you have the same problem?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Cannot use DigitalOcean Spaces as CDN’ is closed to new replies.