feat: configure S3 client with explicit endpoint URL and signature version v4
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 22s

This commit is contained in:
vickytechkey 2026-08-16 19:06:23 +05:30
parent e829f5005a
commit 00832194cb

View file

@ -235,12 +235,15 @@ def preview_document(request):
if aws_access and aws_secret:
try:
import boto3
from botocore.client import Config
from django.shortcuts import redirect
s3_client = boto3.client(
's3',
aws_access_key_id=aws_access,
aws_secret_access_key=aws_secret,
region_name=os.environ.get('AWS_REGION', 'ap-south-2')
region_name=os.environ.get('AWS_REGION', 'ap-south-2'),
endpoint_url=f"https://s3.{os.environ.get('AWS_REGION', 'ap-south-2')}.amazonaws.com",
config=Config(signature_version='s3v4')
)
presigned_url = s3_client.generate_presigned_url(
'get_object',