This is not a gateway error, this is a dns error. A quick fix for your POC would be to configure the SDK to use path-style requests instead of virtual-hosted style Virtual hosting of buckets - Amazon Simple Storage Service. Another option would be to manually add a record for each bucket to your hosts file.
In production virtual-hosted style buckets are handled by full-featured DNS servers with wildcard syntax.