Cannot use DigitalOcean Spaces as CDN
-
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!
- The topic ‘Cannot use DigitalOcean Spaces as CDN’ is closed to new replies.