Search code examples
djangoamazon-s3botodjango-storage

How to change private S3 bucket setting to serve images as http (not https) with django-storages?


I am using boto with django-storages to upload images directly to S3 from my django form. Everything is ok, except image url is https. I think having https is overkill and not required for media files. How do I change the setting to serve images as http? Went through documentation, couldn't find right settings.

My AWS setting is as follows.

AWS_ACCESS_KEY_ID = 'xxx'
AWS_SECRET_ACCESS_KEY = 'xxx'
AWS_STORAGE_BUCKET_NAME = 'xxx'
AWS_DEFAULT_ACL = 'private'
AWS_LOCATION = '/media/'

Thanks in advance.


Solution

  • Ok, I read the django-storages source code, and it's there.

    django-storages on github

    All I need to do is set SECURE_URLS to false, like this.

    AWS_S3_SECURE_URLS = False
    

    :)