S3 Source
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
The S3 source allows PreviewProxy to fetch images directly from an Amazon S3 bucket or any S3-compatible object storage (such as Cloudflare R2, RustFS, or Backblaze B2).
Enabling the S3 Source
Section titled “Enabling the S3 Source”The S3 source is disabled by default. Set PP_S3_ENABLED=true along with the required credentials to activate it.
Configuration
Section titled “Configuration”Required Variables
Section titled “Required Variables”| Variable | Description |
|---|---|
PP_S3_ENABLED | Set to true to enable the S3 source. |
PP_S3_BUCKET | Name of the S3 bucket to fetch images from. |
PP_S3_ACCESS_KEY_ID | AWS access key ID (or equivalent for S3-compatible storage). |
PP_S3_SECRET_ACCESS_KEY | AWS secret access key (or equivalent for S3-compatible storage). |
Optional Variables
Section titled “Optional Variables”| Variable | Default | Description |
|---|---|---|
PP_S3_REGION | us-east-1 | AWS region where the bucket is hosted. |
PP_S3_ENDPOINT | (unset) | Custom endpoint URL for S3-compatible storage providers. |
Example Configuration
Section titled “Example Configuration”PP_S3_ENABLED=truePP_S3_BUCKET=my-assetsPP_S3_REGION=us-east-1PP_S3_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLEPP_S3_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY# For Cloudflare R2, RustFS, or S3-compatible storage:# PP_S3_ENDPOINT=https://<account_id>.r2.cloudflarestorage.comURL Scheme
Section titled “URL Scheme”To request an image from S3, use the s3: scheme in the image URL portion of the path. Note that the scheme uses a single slash after the colon (not two):
/800x600,webp/s3:/images/product/photo.jpgThe path after s3:/ is the object key within the configured bucket.
Examples
Section titled “Examples”| Request | Object Key Fetched |
|---|---|
/w=400/s3:/banner.jpg | banner.jpg |
/800x600,webp/s3:/images/product/photo.jpg | images/product/photo.jpg |
/format=avif/s3:/2024/uploads/avatar.png | 2024/uploads/avatar.png |
Using with Cloudflare R2
Section titled “Using with Cloudflare R2”To use PreviewProxy with Cloudflare R2, set PP_S3_ENDPOINT to the S3 API address:
PP_S3_ENABLED=truePP_S3_BUCKET=my-assetsPP_S3_REGION=autoPP_S3_ACCESS_KEY_ID=<access_key>PP_S3_SECRET_ACCESS_KEY=<secret_key>PP_S3_ENDPOINT=https://<account_id>.r2.cloudflarestorage.comUsing with RustFS
Section titled “Using with RustFS”To use PreviewProxy with RustFS, set PP_S3_ENDPOINT to your RustFS server address:
PP_S3_ENABLED=truePP_S3_BUCKET=my-assetsPP_S3_REGION=us-east-1PP_S3_ACCESS_KEY_ID=<access_key>PP_S3_SECRET_ACCESS_KEY=<secret_key>PP_S3_ENDPOINT=http://<rustfs-host>:<port>