bagetter / BaGetter

A lightweight NuGet and symbol server
https://www.bagetter.com
MIT License
272 stars 57 forks source link

Inconsistent methods to access an S3-compatible endpoint #182

Open tgquan67 opened 2 months ago

tgquan67 commented 2 months ago

Describe the bug

When I configure a MinIO bucket as backend storage for BaGetter, if I use IP address for the endpoint, it works normally as expected. However if I use the FQDN instead of IP address, it seems BaGetter will try to prepend the bucket name to the endpoint's FQDN and expect the DNS server to be able to resolve that, as well as the storage server to support that. However in my case it's not desirable. Since this behavior was not described in the documentation, is there any clear flag/instruction to clearly define this behavior?

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of BaGetter '1.4.8'
  2. Define storage as follow
    "Storage": {
    "Type": "AwsS3",
    "Endpoint": "http://minio.minio-storage-tenant-1.svc.cluster.local",
    "Bucket": "testbucket",
    "AccessKey": "something",
    "SecretKey": "something"
    },
  3. BaGetter will try to access testbucket.minio.minio-storage-tenant-1.svc.cluster.local, which is not defined or resolved.

Expected behavior

Interact with the endpoint in the same way as when Endpoint is defined as "Endpoint": "http://10.0.9.106"

viceice commented 1 month ago

This probably needs a new PathStyle=true config option

https://github.com/bagetter/BaGetter/blob/087ca2079acd76ff00db194140fb7f23c2247f23/src/BaGetter.Aws/AwsApplicationExtensions.cs#L35 https://github.com/aws/aws-sdk-net/blob/b5c10d5d48299f6c68286ee48039bc4ecbc21019/sdk/src/Services/S3/Custom/AmazonS3Config.cs#L67

So the aws sdk is using path style urls.