I am trying to use the AWS PHP SDK to pre-sign V4 POST URLs and am hitting a major problem.
I have created a bucket called bucket1.chris.com. This has a CNAME to bucket1.chris.com.s3-eu-west-1.amazonaws.com.
When I create the S3Client I am passing http://bucket1.chris.com as the enpoint and bucket1.chris.com as the bucket name. Once the URL is signed and I get the action from the formAttributes it is:
bucket1.chris.com.bucket1.chris.com
Looking at the generateUri function in PostObjectV4 I can see this line:
// Use virtual-style URLs
$uri = $uri->withHost($this->bucket . '.' . $uri->getHost());
Which is causing my problem.
If I don't pass an endpoint I get:
s3-eu-west-1.amazonaws.com/bucket1.chris.com
(This is throwing an error: "The specified method is not allowed against this resource" when I try to use it but I think this might be something else)
Does anyone know how I you are supposed to use CNAME records (virtual hosted buckets) with the AWS PHP SDK?