[Solved]-Django storage s3 media url is https:// instead of http://

16👍

I would try adding this property to your settings:

AWS_S3_SECURE_URLS = False

It doesn’t look like it’s documented after a brief glance at the django-storages docs, but this blog talks about it a bit more.
http://www.eliotk.net/05/30/force-http-with-django-storages-and-s3boto/

9👍

You could probably solve this with a single AWS_S3_SECURE_URLS = False. However these settings are in flux as of the current version 1.1.6 so here’s a bit more detail on related settings:

AWS_S3_SECURE_URLS = False
AWS_S3_URL_PROTOCOL = 'http'
AWS_STORAGE_BUCKET_NAME = 'mybucket'
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME

AWS_S3_URL_PROTOCOL is the new way and if set to an empty string allows protocol relative URLs. For backwards compatibility you still need AWS_S3_SECURE_URLS. And at the moment AWS_S3_CUSTOM_DOMAIN is necessary if you are using AWS_S3_URL_PROTOCOL. Here’s some developer discussion on implementing protocol relative URLs with the S3Boto backend.

It’s also worth noting Django-storages provides an S3 backend as well as a different S3Boto backend. Your question doesn’t make the one you are using clear though your code does.

Leave a comment