Virtual-hosted–style requests
Configure path-style and virtual-hosted–style S3 URLs for RustFS.
RustFS supports both S3 URL addressing styles:
- Virtual-hosted–style
- Path-style
The difference is where the bucket name appears in the URL.
Path-style addressing
Path-style addressing is the default. In a path-style URL, the bucket name follows the endpoint.
Example (bucket: my-bucket, host: rustfs.example.com):
http://rustfs.example.com/my-bucketNo extra configuration
Path-style addressing works without RUSTFS_SERVER_DOMAINS.
Virtual-hosted–style addressing
In a virtual-hosted–style URL, the bucket name is part of the hostname.
Example (bucket: my-bucket, host: rustfs.example.com):
http://my-bucket.rustfs.example.com/Configure the domain
- Create a wildcard DNS record (for example,
*.rustfs.example.com→ your server's IP address). - Set
RUSTFS_SERVER_DOMAINS=rustfs.example.comin the server configuration (Linux:/etc/default/rustfs; Docker or Kubernetes: the same environment variable). Do not include a port when clients use the S3 API listener's own port. - Restart RustFS (
sudo systemctl restart rustfson a systemd install).
Virtual-hosted routing applies to the S3 API listener (port 9000 by default). RustFS matches Host headers that use that listener's port. Include a port in RUSTFS_SERVER_DOMAINS only when clients reach RustFS through a different port, for example a proxy on port 8000.
RUSTFS_SERVER_DOMAINS=rustfs.example.com:8000Requests such as the following are then routed with virtual-hosted–style addressing:
http://my-bucket.rustfs.example.com:8000/Match the Host header
The value of RUSTFS_SERVER_DOMAINS must exactly match the Host header (including the port, if present) that clients send.