diff --git a/zerver/lib/upload/s3.py b/zerver/lib/upload/s3.py index 7b4099057f..d22c85099d 100644 --- a/zerver/lib/upload/s3.py +++ b/zerver/lib/upload/s3.py @@ -65,6 +65,7 @@ def get_bucket(bucket_name: str, authed: bool = True) -> Bucket: endpoint_url=settings.S3_ENDPOINT_URL, config=Config( signature_version=None if authed else botocore.UNSIGNED, + s3={"addressing_style": settings.S3_ADDRESSING_STYLE}, ), ).Bucket(bucket_name) diff --git a/zproject/default_settings.py b/zproject/default_settings.py index 0f6e3a22ba..91d0ef9c59 100644 --- a/zproject/default_settings.py +++ b/zproject/default_settings.py @@ -148,6 +148,7 @@ S3_AVATAR_BUCKET = "" S3_AUTH_UPLOADS_BUCKET = "" S3_REGION: Optional[str] = None S3_ENDPOINT_URL: Optional[str] = None +S3_ADDRESSING_STYLE: Literal["auto", "virtual", "path"] = "auto" S3_SKIP_PROXY = True S3_UPLOADS_STORAGE_CLASS: Literal[ "GLACIER_IR", diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.py index 63969f5efc..adc18a92cd 100644 --- a/zproject/prod_settings_template.py +++ b/zproject/prod_settings_template.py @@ -788,6 +788,7 @@ LOCAL_UPLOADS_DIR = "/home/zulip/uploads" # S3_AVATAR_BUCKET = "" # S3_REGION = None # S3_ENDPOINT_URL = None +# S3_ADDRESSING_STYLE = "auto" # S3_SKIP_PROXY = True # S3_UPLOADS_STORAGE_CLASS = "STANDARD"