fix: disable forcePathStyle for DigitalOcean Spaces to ensure correct CORS behavior
This commit is contained in:
@@ -42,7 +42,11 @@ export class UploadService {
|
||||
// Add custom endpoint for S3-compatible services (Contabo, MinIO, DigitalOcean, etc.)
|
||||
if (this.endpoint) {
|
||||
s3Config.endpoint = this.endpoint;
|
||||
s3Config.forcePathStyle = true; // Required for most S3-compatible services
|
||||
// DigitalOcean Spaces: use virtual-hosted-style (bucket.region.digitaloceanspaces.com)
|
||||
// so CORS rules on the bucket are properly applied.
|
||||
// Path-style URLs (region.digitaloceanspaces.com/bucket) bypass CORS on DO Spaces.
|
||||
const isDigitalOceanSpaces = this.endpoint.includes('digitaloceanspaces.com');
|
||||
s3Config.forcePathStyle = !isDigitalOceanSpaces;
|
||||
}
|
||||
|
||||
this.s3Client = new S3Client(s3Config);
|
||||
|
||||
Reference in New Issue
Block a user