Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'foo.bar.com.s3.amazonaws.com' doesn't match either of '*.s3.amazonaws.com', 's3.amazonaws.com'

I'm using django, and things like imgs I store at s3 (for this I'm using boto), but recently I got this error:

'foo.bar.com.s3.amazonaws.com' doesn't match either of '*.s3.amazonaws.com', 's3.amazonaws.com'

I'm searching for a possible solution for about two days, but the unique things that is suggested is to change boto's source code, however I can't do this on production.

Edit: Using Django 1.58, Boto 2.38.0

Any help would be appreciated. Thx in advance.

like image 551
Nikolas Daroit Avatar asked Dec 14 '22 10:12

Nikolas Daroit


1 Answers

As has been said, the problem occurs in buckets containing dots on name. Below just an example that prevents this.

import boto
from boto.s3.connection import VHostCallingFormat

c = boto.connect_s3(aws_access_key_id='your-access-key',
                    is_secure=False,
                    aws_secret_access_key='your-secret-access',
                    calling_format=VHostCallingFormat())
b = c.get_bucket(bucket_name='your.bucket.with.dots', validate=True)
print(b)
like image 57
Eduardo Avatar answered Jan 17 '23 14:01

Eduardo