Skip to content

Commit 1c424ed

Browse files
eersinyildizzersin.yildiz
andauthored
Add ForcePathStyle support to AWSS3Config for MinIO compatibility (#1039)
## Motivation and Context (Why the change? What's the scenario?) This PR adds support for `ForcePathStyle` configuration in `AWSS3Config` ## High level description (Approach, Design) - Added a `ForcePathStyle` boolean property to `AWSS3Config` (default: `false`) - Updated `AWSS3Storage` to pass the value to the `AmazonS3Config.ForcePathStyle` property - Maintains backward compatibility with AWS S3 by leaving the default behavior unchanged - Improves compatibility with services like MinIO, LocalStack, and others that require path-style requests This change is fully backward compatible and has no effect on current configurations unless explicitly enabled. Co-authored-by: ersin.yildiz <ersin.yildiz@obase.com>
1 parent 4fa2cc5 commit 1c424ed

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

extensions/AWS/S3/AWSS3Config.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ public enum AuthTypes
3939
/// </summary>
4040
public string BucketName { get; set; } = string.Empty;
4141

42+
/// <summary>
43+
/// When true, uses path-style addressing for S3 requests (e.g., https://s3.example.com/bucket-name/object).
44+
/// This is required for S3-compatible services like MinIO that do not support virtual-hosted–style URLs.
45+
/// </summary>
46+
public bool ForcePathStyle { get; set; } = false;
47+
4248
public void Validate()
4349
{
4450
if (this.Auth == AuthTypes.Unknown)

extensions/AWS/S3/AWSS3Storage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public AWSS3Storage(
3737
awsSecretAccessKey: config.SecretAccessKey,
3838
clientConfig: new AmazonS3Config
3939
{
40+
ForcePathStyle = config.ForcePathStyle,
4041
ServiceURL = config.Endpoint,
4142
LogResponse = true
4243
}
@@ -47,6 +48,7 @@ public AWSS3Storage(
4748
{
4849
this._client = new AmazonS3Client(new AmazonS3Config
4950
{
51+
ForcePathStyle = config.ForcePathStyle,
5052
ServiceURL = config.Endpoint,
5153
LogResponse = true
5254
});

0 commit comments

Comments
 (0)