Virtual-Hosted–Style Requests
Configure path-style and virtual-hosted–style S3 URLs for RustFS.
RustFS supports both S3 URL addressing styles:
- Virtual Host Style
- Path Style
The two styles differ in where the bucket name appears in the URL.
Path Style
Path-style addressing is the default. In a path-style URL, the bucket name follows the endpoint.
Example (Bucket: test, Host: rustfs.yourdomain.com):
http://rustfs.yourdomain.com/testNote: No configuration is required for Path Style.
Virtual Host Style
In Virtual Host Style, the bucket name is part of the domain.
Example (Bucket: test, Host: rustfs.yourdomain.com):
http://test.rustfs.yourdomain.com/Configuration
- DNS: Create a wildcard DNS record (for example,
*.rustfs.yourdomain.com→ your server's IP address). - Configuration: Modify the configuration file (Linux:
/etc/default/rustfs, Docker/K8s: env vars). - Set Domain: Set
RUSTFS_SERVER_DOMAINS = "rustfs.yourdomain.com". - Restart: Restart the service (
systemctl restart rustfs).
Port in Domain (Optional)
Virtual-host routing applies to the S3 API listener (port 9000 by default); RustFS automatically matches Host headers that carry the S3 listener's own port. Only when clients reach RustFS through a different port (for example via a proxy) do you need to include that port in RUSTFS_SERVER_DOMAINS.
Example (rustfs.yourdomain.com:8000):
RUSTFS_SERVER_DOMAINS = "rustfs.yourdomain.com:8000"This ensures that requests like:
http://my-bucket.rustfs.yourdomain.com:8000/are routed correctly with virtual-hosted–style addressing.
Match the Host header
The value of RUSTFS_SERVER_DOMAINS must exactly match the Host header (including the port, if present) that clients send.