I've got a situation here at work where I need to support host based bucket routing as well as path-based at the same time. This PR adds a new middleware which, if enabled, takes precedence over the existing "all or nothing" middleware, that will support host-based bucket routing if and only if the host is a subdomain of the configured hosts.
If we start gofakes3 with the example.com host (and autobucket turned on just to make things easier):
go run ./cmd/gofakes3/ -backend=mem -autobucket -hostbucketbase=example.com
Requests for example.com will presume the first path segment is the bucket name:
Hallo Johannes! Hope you're well.
I've got a situation here at work where I need to support host based bucket routing as well as path-based at the same time. This PR adds a new middleware which, if enabled, takes precedence over the existing "all or nothing" middleware, that will support host-based bucket routing if and only if the host is a subdomain of the configured hosts.
If we start gofakes3 with the
example.com
host (and autobucket turned on just to make things easier):Requests for example.com will presume the first path segment is the bucket name:
Whereas requests for bucket.example.com will presume the first host segment is the bucket name, and the entire path becomes the object key: