Discourse does not allow dot «.» symbol in bucket name while Amazon S3 allows it

Rules for Bucket Naming from Amazon Documentation:

Bucket names must be a series of one or more labels. Adjacent labels are separated by a single period (.).
<…>
The following examples are valid bucket names:
<…>
my.aws.bucket

Using a domain name as a bucket name is so naturally, especially for site backup, so it would be nice if Discourse will support it.

We did that because we had issues with the gem we used to communicate with S3. Now that we’ve got rid of it, I think it’s safe to loosen the check a bit.

Test it out, I think we may need to use a diff Api unless they fixed it in v2

Just tested it and it worked fine :wink:

2 Likes

Wait, isn’t the dot restriction because it causes HTTPS to fail?

yes, it is:

ssl.CertificateError: hostname 'my.bucket.s3.amazonaws.com' doesn't match either of '*.s3.amazonaws.com', 's3.amazonaws.com'

It’s the SSL certificate, not the gem.

edit: If discourse isn’t always using SSL to talk to s3, that should be fixed. Both on server and client.

2 Likes

Yes I agree, we should just disallow this, its adding complexity where complexity is not needed.

If people want vanity “sexy” names then can use s3_cdn. A solution that only works with HTTP is not really acceptable.

2 Likes

Thanks for figuring that one out :sunny:

https://github.com/discourse/discourse/commit/5de955451027951600e5ad8b76fa7d38e086603d

3 Likes