It's a common concept to put a proxy in front of S3 that handles requests. Nginx is well suited for this and can be used to handle TLS and virtual-hosted style bucket URLs (using subdomains instead of subfolders).
For virtual-hosted style URL buckets, you'll need to add a wildcard DNS record for your S3 subdomain.
Make sure the config sets the X-Forwarded-Host and optionally the X-Forwarded-Port if you are using a non-standard port. SeaweedFS will automatically combine these headers to reconstruct the correct host information for signature verification.
Explicit External URL for Signature Verification
In scenarios where the reverse proxy cannot easily be configured to send the necessary headers, or in complex multi-hop environments, you can use the -s3.externalUrl flag to explicitly set the public-facing URL of the S3 service.
When -s3.externalUrl is set, SeaweedFS will use the host and port from this URL for all S3 signature verification, ignoring incoming Host or X-Forwarded-* headers.
Usage Example
# SeaweedFS S3 is reachable externally at https://s3.example.com:9000
weed s3 -s3.externalUrl=https://s3.example.com:9000
Alternatively, set the environment variable:
export WEED_S3_EXTERNAL_URL=https://s3.example.com:9000
This flag is also supported in weed mini and weed filer:
weed mini -s3.externalUrl=http://localhost:9000
weed filer -s3 -s3.externalUrl=https://s3.mycorp.internal
Why use this?
AWS Signature V4 includes the Host header in the signed payload. If SeaweedFS is behind a proxy, the Host header it receives might be the internal address (e.g., localhost:8333), while the client signed the request with the external address (e.g., s3.example.com). Setting -s3.externalUrl ensures SeaweedFS uses the correct host for signature validation.
Reverse Proxy with URL Path Prefixes
SeaweedFS S3 API supports the X-Forwarded-Prefix header for scenarios where a reverse proxy strips URL path prefixes before forwarding requests. This is common when hosting the S3 API under a subpath like /s3/ or /api/s3/.
How X-Forwarded-Prefix Works
When a reverse proxy strips a URL prefix:
- Client request:
https://example.com/s3/my-bucket/my-object - Proxy strips prefix and forwards:
https://backend:8333/my-bucket/my-object - Proxy adds header:
X-Forwarded-Prefix: /s3
SeaweedFS will:
- First attempt signature verification using the original path (
/s3/my-bucket/my-object) - Fall back to verification using the stripped path (
/my-bucket/my-object) if the first attempt fails
This ensures both regular S3 requests and presigned URLs work correctly with reverse proxies that strip prefixes.
Example Use Cases
- API Gateway:
/api/s3/bucket/object→/bucket/object - Multi-tenant setup:
/tenant1/s3/bucket/object→/bucket/object - Subpath hosting:
/storage/s3/bucket/object→/bucket/object
Important Notes
- The
X-Forwarded-Prefixheader should contain the stripped prefix (e.g.,/s3) X-Forwarded-Portis automatically combined withX-Forwarded-Hostfor non-standard ports- Standard ports (80 for HTTP, 443 for HTTPS) are omitted from the host header automatically
- Both regular S3 authentication and presigned URLs are supported
- This feature works with all S3 operations that require signature verification
Additionally, make sure that proxy_request_buffering is off (default is on), as the proxy will buffer the request, and send the request to the backend as a whole instead of chunked, and again the signature computed by the client side will be different as it would have taken into account the Transfer-Encoding: chunked header that is dropped by the proxy when it buffers.
Example Nginx config
Standard Configuration (without URL prefix stripping)
upstream seaweedfs {
# Hash on uploadId query string in the GET request create consistency for multipart uploads,
# only necessary when using local embedded filer store (leveldb)
hash $arg_uploadId consistent;
server localhost:8333 fail_timeout=0;
keepalive 20;
}
## Also you can use unix domain socket instead for better performance:
# upstream seaweedfs { server unix:/tmp/seaweedfs-s3-8333.sock; keepalive 20;}
server {
listen 443 ssl;
# Assumes that your subdomain is s3
# The regex will support path style as well as virtual-hosted style bucket URLs
# path style: http://s3.yourdomain.com/mybucket
# virtual-hosted style: http://mybucket.s3.yourdomain.com
server_name ~^(?:(?<bucket>[^.]+)\.)?s3\.yourdomain\.com;
ignore_invalid_headers off;
# Make sure that we can upload files larger than 1MB (nginx default cutoff)
client_max_body_size 0;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 300;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_request_buffering off;
chunked_transfer_encoding off;
# If bucket subdomain is not empty,
# rewrite request to backend.
if ($bucket != "") {
rewrite (.*) /$bucket$1 last;
}
location / {
proxy_pass http://seaweedfs;
}
ssl on;
ssl_certificate /{path_to_ssl_cert}/cert.pem;
ssl_certificate_key /{path_to_ssl_cert}/key.pem;
}
Configuration with URL Prefix Stripping (X-Forwarded-Prefix)
For scenarios where you need to host SeaweedFS S3 API under a subpath:
upstream seaweedfs {
hash $arg_uploadId consistent;
server localhost:8333 fail_timeout=0;
keepalive 20;
}
server {
listen 443 ssl;
server_name yourdomain.com;
ignore_invalid_headers off;
# Make sure that we can upload files larger than 1MB (nginx default cutoff)
client_max_body_size 0;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 300;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_request_buffering off;
chunked_transfer_encoding off;
# S3 API under /s3/ subpath
location /s3/ {
# Set the X-Forwarded-Prefix header to the stripped prefix
proxy_set_header X-Forwarded-Prefix /s3;
# Strip the /s3 prefix before forwarding to backend
rewrite ^/s3/(.*) /$1 break;
proxy_pass http://seaweedfs;
}
# Alternative: S3 API under /api/s3/ subpath
location /api/s3/ {
proxy_set_header X-Forwarded-Prefix /api/s3;
rewrite ^/api/s3/(.*) /$1 break;
proxy_pass http://seaweedfs;
}
ssl on;
ssl_certificate /{path_to_ssl_cert}/cert.pem;
ssl_certificate_key /{path_to_ssl_cert}/key.pem;
}
Introduction
- Quick Start with weed mini
- Simplest S3 Bucket and User Setup
- Components
- Getting Started
- Production Setup
- A typical step‐by‐step example
- Benchmarks
- FAQ
- Applications
API
Configuration
- Replication
- Store file with a Time To Live
- Failover Master Server
- Erasure coding for warm storage
- EC Bitrot Detection
- Server Startup via Systemd
- Environment Variables
Filer
- Filer Setup
- Directories and Files
- File Operations Quick Reference
- Data Structure for Large Files
- Filer Data Encryption
- Filer Commands and Operations
- Filer JWT Use
- TUS Resumable Uploads
Filer Stores
- Filer Cassandra Setup
- Filer Redis Setup
- Super Large Directories
- Path-Specific Filer Store
- Choosing a Filer Store
- Customize Filer Store
Management
Advanced Filer Configurations
- Migrate to Filer Store
- Add New Filer Store
- Filer Store Replication
- Filer Active Active cross cluster continuous synchronization
- Filer as a Key-Large-Value Store
- Path Specific Configuration
- Filer Change Data Capture
- Filer Operation Serialization
FUSE Mount
- FIO benchmark
- fstab and systemd mount
- POSIX Compliance
- Distributed POSIX Locks
- P2P reading in weed mount
WebDAV
SFTP Server
Cloud Drive
- Cloud Drive Benefits
- Cloud Drive Architecture
- Configure Remote Storage
- Mount Remote Storage
- Cache Remote Storage
- Cloud Drive Quick Setup
- Gateway to Remote Object Storage
AWS S3 API
- Amazon S3 API
- Supported APIs vs Minio
- S3 Lifecycle
- S3 Lifecycle vs Volume TTL
- S3 Conditional Operations
- S3 CORS
- S3 Object Lock and Retention
- S3 Object Versioning
- S3 API Benchmark
- S3 API FAQ
- S3 Bucket Quota
- S3 Rate Limiting
- S3 API Audit log
- S3 Nginx Proxy
- Docker Compose for S3
S3 Table Bucket
- S3 Table Bucket
- S3 Table Bucket Commands
- S3 Tables Security
- SeaweedFS Iceberg Catalog
- Iceberg Table Maintenance
Iceberg Integrations
- Spark Iceberg Integration
- Trino Iceberg Integration
- Dremio Iceberg Integration
- DuckDB Iceberg Integration
- Doris Iceberg Integration
- RisingWave Iceberg Integration
- Lakekeeper Iceberg Integration
S3 Authentication & IAM
- S3 Configuration - Start Here
- S3 Credentials (
-s3.config) - OIDC Integration (
-s3.iam.config) - Kubernetes ServiceAccount Authentication (IRSA-style)
- S3 Policy Variables
- S3 Policy Conditions
- S3 Bucket Policies
- Amazon IAM API
- AWS IAM CLI
- weed shell - Shell IAM Commands
Server-Side Encryption
S3 Client Tools
- AWS CLI with SeaweedFS
- s3cmd with SeaweedFS
- rclone with SeaweedFS
- restic with SeaweedFS
- nodejs with Seaweed S3
Machine Learning
HDFS
- Hadoop Compatible File System
- run Spark on SeaweedFS
- run HBase on SeaweedFS
- run Presto on SeaweedFS
- Hadoop Benchmark
- HDFS via S3 connector
Replication and Backup
- Async Replication to another Filer [Deprecated]
- Async Backup
- Async Filer Metadata Backup
- Async Replication to Cloud [Deprecated]
- Kubernetes Backups and Recovery with K8up
Metadata Change Events
Messaging
- Structured Data Lake with SMQ and SQL
- Seaweed Message Queue
- SQL Queries on Message Queue
- SQL Quick Reference
- PostgreSQL-compatible Server weed db
- Pub-Sub to SMQ to SQL
- Kafka to Kafka Gateway to SMQ to SQL
Use Cases
Operations
- System Metrics
- weed shell
- Data Backup
- Deployment to Kubernetes and Minikube
- Deployment with seaweed-up
Rust Volume Server
Advanced
- Large File Handling
- Optimization
- Optimization for Many Small Buckets
- Volume Management
- Tiered Storage
- Cloud Tier
- Cloud Monitoring
- Load Command Line Options from a file
- SRV Service Discovery
- Volume Files Structure
Security
- Security Overview
- Security Configuration
- Cryptography and FIPS Compliance
- Run Blob Storage on Public Internet