From 30ad03d4ca935ed528948db370a0300d75176198 Mon Sep 17 00:00:00 2001 From: Fernando Date: Wed, 6 Jan 2021 09:50:31 +0000 Subject: [PATCH] Update S3 CORS documentation for Boto3 (#6668) Boto3 has been around for a long time now. Adding a Boto-specific parameter in a tutorial is confusing (it was for me) as people are likely to install Boto3 directly and skip Boto. The `AWS_HEADERS` parameter was replaced by the `AWS_S3_OBJECT_PARAMETERS` parameter in Boto3 and the parameter that controls the access control list specifically is the `ACL`. By the way, are the instructions on line 50 still relevant today? --- CONTRIBUTORS.rst | 1 + docs/advanced_topics/deploying.rst | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 00a65c7682..3436b2b5ea 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -490,6 +490,7 @@ Contributors * Kristin Riebe * Vadim Karpenko * Bohreromir +* Fernando Cordeiro Translators =========== diff --git a/docs/advanced_topics/deploying.rst b/docs/advanced_topics/deploying.rst index 22a36fdced..1702e55af5 100644 --- a/docs/advanced_topics/deploying.rst +++ b/docs/advanced_topics/deploying.rst @@ -49,13 +49,15 @@ Wagtail follows :doc:`Django's conventions for managing uploaded files `_ setting), you'll need to ensure that it is configured to serve `CORS HTTP headers `_, as current browsers will reject remotely-hosted font files that lack a valid header. For Amazon S3, refer to the documentation `Setting Bucket and Object Access Permissions `_, or (for the ``storages.backends.s3boto.S3BotoStorage`` backend only) add the following to your Django settings: +If you are also serving Wagtail's static files from remote storage (using Django's `STATICFILES_STORAGE `_ setting), you'll need to ensure that it is configured to serve `CORS HTTP headers `_, as current browsers will reject remotely-hosted font files that lack a valid header. For Amazon S3, refer to the documentation `Setting Bucket and Object Access Permissions `_, or (for the ``storages.backends.s3boto.S3Boto3Storage`` backend only) add the following to your Django settings: .. code-block:: python - AWS_HEADERS = { - 'Access-Control-Allow-Origin': '*' + AWS_S3_OBJECT_PARAMETERS = { + "ACL": "public-read" } + +The ``ACL`` parameter accepts a list of predefined configurations for Amazon S3. For more information, refer to the documentation `Canned ACL `_. For Google Cloud Storage, create a ``cors.json`` configuration: