Reputation: 17377
I'm using the S3 REST api to manage objects in my bucket. This is working when my bucket name has dashes in it. For example, the host for a REST request would be my-bucket-name.s3.amazonaws.com
.
I have another bucket named www.my-bucket-name.com
, which would have the following host in a rest request: www.my-bucket-name.com.s3.amazonaws.com
. Requests for bucket names like this will fail with Unable to communicate securely with peer: requested domain name does not match the server's certificate.
. Per the docs, www.my-bucket-name.com
is a valid bucket name. Do I need to encode it somehow? Is there some sort of alias?
Upvotes: 2
Views: 710
Reputation: 179054
This is one of the reasons S3 supports the virtual host method you're using, as well as the alternate, path-style method, for accessing buckets and their objects via the REST endpoint.
https://example.com.s3.amazonaws.com/foo
https://s3.amazonaws.com/example.com/foo
These reference the same object, but the second form works with SSL since the hostname matches the S3 wildcard cert (which is the problem you are experiencing -- wildcard SSL certs don't match dots in the hostname portion being wildcarded).
http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html
There are some legitimate reasons to put dots in a bucket name.
Upvotes: 2