3

I'm using aws-sdk-go (https://github.com/aws/aws-sdk-go) to connect so AWS S3. I also want to support MinIO (http://minio.io/) through the same code. But due to some restrictions on my part I can't use S3ForcePathStyle flag in config. Is there any way I can setup my MinIO server to support Virtual Hosted-Style paths?

P.S. I also tried setting MINIO_DOMAIN environment variable as instructed here https://docs.min.io/docs/minio-server-configuration-guide.html

Thanks in advance!

1 Answers1

10

By default, MinIO supports path-style requests that are of the format http://example.com/bucket/object. MINIO_DOMAIN environment variable is used to enable virtual-host-style requests. If you configure MINIO_DOMAIN, MinIO will support both path-style and virtual-host-style requests from the clients.

export MINIO_DOMAIN=mydomain.com
minio server /data
  • 1
    I added an environment variable as you suggested but this causes a CORS violation on my machine, because the sdk places requests to .mydomain.com Indeed, when I add a second DNS entry to support subdomains, the CORS preflight check passes, but then I only see a description of the bucket, not its contents. It seems that Minio doesn't switch to the virtual host style. I can reproduce the the output with Postman by applying the respective paths to the GET request: http://projects.facerec.local:9000/projects How did you solve this problem? – Omnibyte Sep 17 '20 at 12:59
  • 1
    @Omnibyte For my case, I just wanted the aws-sdk-go code to call the MinIO server. It was purely backend, so I didn't face any CORS issue. For your case maybe you can use a proxy, something like [http://example.com/call-minio?path=http://bucket.minio-host.com/object](http://example.com/call-minio?path=http://bucket.minio-host.com/object) OR [http://example.com/call-minio?path=http://minio-host.com/bucket/object](http://example.com/call-minio?path=http://minio-host.com/bucket/object) and then handle the request via backend. There might be better ways to handle your issue. Hope this helps :) – abhijit wakchaure Sep 22 '20 at 12:11