- Newest
- Most votes
- Most comments
The issue you're experiencing with accessing your S3 bucket using virtual hosted style is related to SSL certificate validation when using buckets with dots (.) in their names. When using virtual-hosted–style buckets with SSL, the SSL wildcard certificate only matches buckets that do not contain dots.
In your case, the bucket name "example-bucket.turborepo-remote-cache-7789096546546" contains dots, which is causing the SSL certificate validation to fail. This is why you're seeing the error message indicating that the hostname does not match the certificate's altnames.
The reason it works when you use underscores instead of hyphens (example_bucket) is that underscores don't introduce the same SSL certificate validation issues as dots do.
To work around this limitation, you have a few options:
- Use HTTP instead of HTTPS for accessing the bucket (though this is not recommended for security reasons).
- Implement your own certificate-verification logic that can handle buckets with dots in their names.
- Consider using path-style URLs instead of virtual-hosted style for buckets with dots in their names.
- If possible, rename your bucket to avoid using dots in the name.
It's worth noting that Amazon S3 is moving towards deprecating path-style URLs in favor of virtual-hosted style, so the long-term solution would be to adjust your bucket naming strategy to avoid dots or implement custom certificate verification.
Sources
Virtual hosting of buckets - Amazon Simple Storage Service
Naming Amazon S3 objects - Amazon Simple Storage Service
Underscores in bucket names are not supported.
I think you misunderstood the problem, I am accessing s3 folder using access-point and for that hyphens are not working. note: using aws-sdk for these operations
You don’t use the bucket name in the access point url.
Please see information how you access an S3 bucket when using access points.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html
Thanks for providing the documentation. I used a normal S3 URL instead of an access point, but still encountered a DNS issue with the folder named learning-platform-cache-v2. ERROR: Host: learning-platform-cache-v2.turborepo-cache-alpha.s3.ap-southeast-2.amazonaws.com Certificate altnames:
- DNS:s3-ap-southeast-2.amazonaws.com
- DNS:*.s3-ap-southeast-2.amazonaws.com
- DNS:s3.ap-southeast-2.amazonaws.com
- DNS:*.s3.ap-southeast-2.amazonaws.com
- DNS:s3.dualstack.ap-southeast-2.amazonaws.com
- DNS:*.s3.dualstack.ap-southeast-2.amazonaws.com
- DNS:*.s3.amazonaws.com
- DNS:*.s3-control.ap-southeast-2.amazonaws.com
- DNS:s3-control.ap-southeast-2.amazonaws.com
- DNS:*.s3-control.dualstack.ap-southeast-2.amazonaws.com
- DNS:s3-control.dualstack.ap-southeast-2.amazonaws.com
- DNS:s3-deprecated.ap-southeast-2.amazonaws.com"Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: learning-platform-cache-v2.turborepo-cache-alpha.s3.ap-southeast-2.amazonaws.com. is not in the cert's altnames: DNS:s3-ap-southeast-2.amazonaws.com, DNS:.s3-ap-southeast-2.amazonaws.com, DNS:s3.ap-southeast-2.amazonaws.com, DNS:.s3.ap-southeast-2.amazonaws.com, DNS:s3.dualstack.ap-southeast-2.amazonaws.com, DNS:.s3.dualstack.ap-southeast-2.amazonaws.com, DNS:.s3.amazonaws.com, DNS:*.s3-control.ap-southeast-2.amazonaws.com, DNS:s3-control.ap-southeast-2."
You dont have foldernames in the bucket name. The folder forms part of the URi
EG
https://turborepo-cache-alpha.s3.ap-southeast-2.amazonaws.com/learning-platform-cache-v2
thanks for helping @garyMclean,
I discovered that I was using the aws-sdk which employs both Host Style and Path Style access for S3. However, using Host Style access was causing DNS network issues. Therefore, I switched to Path Style access, and now everything is working fine.
answered 2 years ago
Relevant content
asked 7 years ago

According to the documentation https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html, hyphens are allowed, and in my implementation, I did not use any dots for the bucket folder name.