Repository: jschneier/django-storages

Issue:
`AWS_S3_USE_SSL` doesn't work but `AWS_S3_SECURE_URLS` does
Locally to test my AWS parameters i use [minio](https://min.io/?utm_term=minio&utm_campaign=MinIO-Search-Google+Build+-+International&utm_source=adwords&utm_medium=ppc&hsa_acc=8976569894&hsa_cam=11154547880&hsa_grp=108939911709&hsa_ad=466333759841&hsa_src=g&hsa_tgt=kwd-301105367935&hsa_kw=minio&hsa_mt=p&hsa_net=adwords&hsa_ver=3&gclid=EAIaIQobChMIs-_jkr_y9gIVpo9oCR2TvA6lEAAYASAAEgLelPD_BwE). For that I want to communicate in `http` and not `https` so i activated the option `AWS_S3_USE_SSL = False` but the connection is still in `https`. I found the parameters `AWS_S3_SECURE_URLS` in the repo code (not documented) and it seems to work fine.
Can i rely on `AWS_S3_SECURE_URLS` or you have plan to remove it in the future?


Discussion:
Thanks, that helped!
Was just going through the code and learned that AWS_S3_SECURE_URLS is not the only relevant setting that is not currently mentioned in the docs.  There's also AWS_S3_URL_PROTOCOL, which appears to combine with AWS_S3_CUSTOM_DOMAIN.  That's important to know.
I just went through the code careful and audited the use of all URL-related options, then created a personal cheatsheet in my wiki.  Screenshot attached.

Also of note is that while the [django-storages docs](https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html) say:

> As of boto3 version 1.13.21 the default signature version used for generating presigned urls is still v2. To be able to access your s3 objects in all regions through presigned urls, explicitly set this to s3v4.

The boto3 [docs](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#using-the-config-object) now say:

> Note that the default version is Signature Version 4. If you're using a presigned URL with an expiry of greater than 7 days, you should specify Signature Version 2.

The django-storages docs should probably be updated to reflect this.

Anyway, hope some of this was helpful to whoever finds their way here.

![Screenshot 2022-06-08 at 12-40-06 django-storages - Ofer Nave - Confluence](https://user-images.githubusercontent.com/155179/172671156-ba96a29b-3033-47f0-a33c-58d2c83686c9.png)
Thanks that's very helpful!

Resolving patch:
diff --git a/storages/backends/s3boto3.py b/storages/backends/s3boto3.py
--- a/storages/backends/s3boto3.py
+++ b/storages/backends/s3boto3.py
@@ -255,12 +255,6 @@ def __init__(self, **settings):
 
         check_location(self)
 
-        # Backward-compatibility: given the anteriority of the SECURE_URL setting
-        # we fall back to https if specified in order to avoid the construction
-        # of unsecure urls.
-        if self.secure_urls:
-            self.url_protocol = 'https:'
-
         self._bucket = None
         self._connections = threading.local()
 
@@ -315,7 +309,6 @@ def get_default_settings(self):
             'custom_domain': setting('AWS_S3_CUSTOM_DOMAIN'),
             'cloudfront_signer': cloudfront_signer,
             'addressing_style': setting('AWS_S3_ADDRESSING_STYLE'),
-            'secure_urls': setting('AWS_S3_SECURE_URLS', True),
             'file_name_charset': setting('AWS_S3_FILE_NAME_CHARSET', 'utf-8'),
             'gzip': setting('AWS_IS_GZIPPED', False),
             'gzip_content_types': setting('GZIP_CONTENT_TYPES', (
@@ -325,7 +318,7 @@ def get_default_settings(self):
                 'application/x-javascript',
                 'image/svg+xml',
             )),
-            'url_protocol': setting('AWS_S3_URL_PROTOCOL', 'http:'),
+            'url_protocol': setting('AWS_S3_URL_PROTOCOL', 'https:'),
             'endpoint_url': setting('AWS_S3_ENDPOINT_URL'),
             'proxies': setting('AWS_S3_PROXIES'),
             'region_name': setting('AWS_S3_REGION_NAME'),


Test patch: