Use path-style URL for AWS Config
vuongphamaioz opened this issue · comments
Hi,
I'm trying to use this library to connect to my self-hosted MinIO Object Storage that has S3-compatible. I connected to my server successfully. But my server uses path-style URL so I can't get buckets on my server. I haven't found any way to config this. Is there any way to do this? For example, in AWS S3 Javascript SDK, this field is named forcePathStyle
.
Thanks.
Hi @vuongphamaioz 👋🏻 I'm not sure I understand what you meant by "path-style URL"? Could you please expand on this?🙏🏻
For instance, it would be super helpful if you could provide examples of the requests you're trying to perform that wouldn't work with the latest version of the project.
Hi @oleiade,
This is the reference link: https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html
The S3 provides 2 types of URL addresses that we send request to, for example:
- Virtual-hosted–style: bucket-name.s3.region-code.amazonaws.com/key-name
- Path-style: s3.region-code.amazonaws.com/bucket-name/key-name
The default of AWS S3 SDK now is virtual-hosted-style.
Below is the example code when I use AWS S3 Javascript SDK.
const s3Client = new S3Client({
region: "us-east-1",
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
},
endpoint: {
url: "https://minio-example.com",
},
forcePathStyle: true,
});
Below is the code that I am trying to do
const awsConfig = new AWSConfig({
region: __ENV.AWS_REGION,
accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
scheme: 'https',
endpoint: "https://minio-example.com",
forcePathStyle: true, // has not this field yet
});
Hope it help.
II see; thanks a lot for the specific example. It does sound like a useful feature to add, indeed, but we would need to do a bit of research to decide on which design would be the best👍🏻 We'll look into it 🙇🏻
Thank you very much 🙏🏻
related #21
I believe this might be fixed by #44, which will be released with version 0.8.0
, but you can already pick up the specific build files you're interested in from the main branch and take it out for a spin.
Closing. Feel free to reopen if you still experience issues 👍🏻