aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrinity Pointard <trinity.pointard@gmail.com>2021-11-15 17:39:36 +0100
committerGitea <gitea@fake.local>2021-11-16 15:41:41 +0100
commit53888995bdd7c672d2e3ab8bb6a3529195c127a9 (patch)
tree9092c0e56a3b580973fec9afd735ada64e1029be
parentf0893b904d2cd9c5e7bedf5205272be5d0c01a33 (diff)
downloadgarage-53888995bdd7c672d2e3ab8bb6a3529195c127a9.tar.gz
garage-53888995bdd7c672d2e3ab8bb6a3529195c127a9.zip
update doc and comments
-rw-r--r--doc/book/src/reference_manual/configuration.md12
-rw-r--r--src/api/api_server.rs3
-rw-r--r--src/api/helpers.rs6
3 files changed, 12 insertions, 9 deletions
diff --git a/doc/book/src/reference_manual/configuration.md b/doc/book/src/reference_manual/configuration.md
index 7eb64c14..61f7bcee 100644
--- a/doc/book/src/reference_manual/configuration.md
+++ b/doc/book/src/reference_manual/configuration.md
@@ -30,7 +30,7 @@ sled_flush_every_ms = 2000
[s3_api]
api_bind_addr = "[::]:3900"
s3_region = "garage"
-root_domain = ".3.garage"
+root_domain = ".s3.garage"
[s3_web]
bind_addr = "[::]:3902"
@@ -179,11 +179,13 @@ message that redirects the client to the correct region.
#### `root_domain`
-The optionnal suffix to access bucket using vhost-style instead of path-style API calls.
+The optionnal suffix to access bucket using vhost-style in addition to path-style request.
+Note path-style requests are always enabled, whether or not vhost-style is configured.
+Configuring vhost-style S3 required a wildcard DNS entry, and possibly a wildcard TLS certificate,
+but might be required by softwares not supporting path-style requests.
-For instance, if `root_domain` is `s3.garage.eu`, a bucket called `deuxfleurs.fr`
-can be interacted with with hostname `deuxfleurs.fr.s3.garage.eu`. Note however you
-can't interact with it using hostname `deuxfleurs.fr` directly.
+If `root_domain` is `s3.garage.eu`, a bucket called `my-bucket` can be interacted with
+using the hostname `my-bucket.s3.garage.eu`.
## The `[s3_web]` section
diff --git a/src/api/api_server.rs b/src/api/api_server.rs
index b67ebef7..74142453 100644
--- a/src/api/api_server.rs
+++ b/src/api/api_server.rs
@@ -263,7 +263,8 @@ async fn handler_inner(garage: Arc<Garage>, req: Request<Body>) -> Result<Respon
}
}
-/// Extract the bucket name and the key name from an HTTP path and possibly Host header
+/// Extract the bucket name and the key name from an HTTP path and possibly a bucket provided in
+/// the host header of the request
///
/// S3 internally manages only buckets and keys. This function splits
/// an HTTP path to get the corresponding bucket name and key.
diff --git a/src/api/helpers.rs b/src/api/helpers.rs
index 9ba32537..2375d35d 100644
--- a/src/api/helpers.rs
+++ b/src/api/helpers.rs
@@ -3,9 +3,9 @@ use idna::domain_to_unicode;
/// Host to bucket
///
-/// Convert a host, like "bucket.garage-site.tld" or "john.doe.com"
-/// to the corresponding bucket, resp. "bucket" and "john.doe.com"
-/// considering that ".garage-site.tld" is the "root domain".
+/// Convert a host, like "bucket.garage-site.tld" to the corresponding bucket "bucket",
+/// considering that ".garage-site.tld" is the "root domain". For domains not matching
+/// the provided root domain, no bucket is returned
/// This behavior has been chosen to follow AWS S3 semantic.
pub fn host_to_bucket<'a>(host: &'a str, root: &str) -> Option<&'a str> {
let root = root.trim_start_matches('.');