fix: force HTTPS S3 endpoint to avoid Coolify 307 on uploads

http://s3 hosts redirect to https; AWS SDK cannot follow PUT redirects, which caused XML parse errors.
This commit is contained in:
2026-08-15 03:04:53 +03:30
parent aa2132f02c
commit e1772a2559
3 changed files with 42 additions and 11 deletions
+6
View File
@@ -80,6 +80,12 @@ const logS3Error = (label, error) => {
+ (status ? ` (HTTP ${status})` : '')
+ (bodyPreview ? ` body=${bodyPreview.replace(/\s+/g, ' ')}` : '')
);
if (status === 307 || /Temporary Redirect/i.test(String(error.message) + bodyPreview)) {
logger.error(
'[S3 Storage ERROR] Hint: HTTP 307 means S3_ENDPOINT is redirecting (often http→https). '
+ `Set S3_ENDPOINT=https://… (current: ${config.S3_ENDPOINT}). AWS SDK does not follow PUT redirects.`
);
}
};
const uploadToTempBucket = async (fileBuffer, filename, contentType = 'application/octet-stream') => {