scireum / s3ninja

S3 ninja emulates the Amazon S3 API for developement and test purposes
MIT License
494 stars 91 forks source link

Compatibility with Kubernetes #211

Open riccardomessineo opened 2 years ago

riccardomessineo commented 2 years ago

Hello there, I am trying to replicate a perfectly running docker-compose config on a k8s cluster using the virtual hosted style feature. Listing the buckets works fine, but accessing the files of a bucket returns an empty set. I'm pretty sure it's a problem related to virtual hosted style buckets on k8s, and I have a hint on where the problem is: https://github.com/scireum/s3ninja/blob/master/src/main/java/ninja/S3Dispatcher.java#L287

While figuring out how to make the s3 request you try to understand the local domains with: https://github.com/scireum/s3ninja/blob/master/src/main/java/ninja/S3Dispatcher.java#L161-L179

To make it work on docker-compose I had to set the hostname property to s3ninja.dev, but on k8s this is not possible!

To fix this can you add a "baseurl" on the config file in the "http" section and use it in the DOMAINS as a value? If I knew Java I would PR this fix...