Guides
Object Storage
Connect MinIO, OSS, COS, Kodo, or AWS S3 for file and media storage.
S3 object storage configuration
OpenIMSDK supports multiple S3-compatible object storage providers: MinIO, Alibaba Cloud OSS, Tencent Cloud COS, Qiniu KODO, and Amazon S3 (AWS).
- Direct client uploads: The SDK uploads media files directly to the S3 bucket via pre-signed URLs, bypassing the API gateway to maximize server throughput and reduce network bottlenecks.
- Access redirection & authorization: Requests routed through the API gateway validate caller permissions and issue HTTP redirects to the real object storage location.
- Nginx reverse proxy: When routing API traffic through Nginx, configure
proxy_set_header X-Request-Api $scheme://$host/api;. For complete reverse proxy examples, see Domain configuration. - Custom S3 providers: To integrate an unlisted S3-compatible storage backend, implement the server interface in OpenIM tools without modifying client SDKs. See s3.go interface definition.
Set the object.enable field in config/openim-rpc-third.yml to your chosen provider: minio, oss, cos, kodo, or aws (default: minio).
object:
enable: minioMinIO
- Set
externalAddressinconfig/minio.ymlto your application's public access URL. OpenIMServer does not need direct network reachability to this address; it uses it only to construct signature URLs for clients. - For Nginx reverse proxy configuration with MinIO, see Domain configuration.
# Target bucket name for file storage
bucket: openim
# Access key ID for MinIO authentication
accessKeyID: root
# Secret access key for MinIO authentication
secretAccessKey: openIM123
# Session token (required only when using temporary STS credentials)
sessionToken:
# Internal service address used strictly for backend RPC calls (typically a private IP or container host)
internalAddress: localhost:10005
# Publicly accessible endpoint (HTTP/HTTPS domain or public IP) reachable by client applications
externalAddress: http://external_ip:10005
# Whether to enable public read permissions on the bucket. When set to true, the bucket is switched to public read. Setting to false does not automatically revert bucket ACL to private.
publicRead: falseAlibaba Cloud OSS
- Create a bucket in the Alibaba Cloud OSS Console.
- Generate API credentials in the Alibaba Cloud RAM Console.
- Refer to the Alibaba Cloud OSS Developer Guide for architecture details.
- Configure
object.ossinconfig/openim-rpc-third.yml:
# OSS regional endpoint, e.g., http://oss-cn-hangzhou.aliyuncs.com
endpoint:
# Target bucket name
bucket:
# Publicly accessible URL for the bucket (such as a CDN accelerated domain)
bucketURL:
# Access key ID
accessKeyID:
# Access key secret
accessKeySecret:
# Session token (required only when using temporary STS credentials)
sessionToken:
# Public read mode. Recommended to keep false so the API can set Content-Type and download file names. If set to true, manage headers in the OSS console.
publicRead: falseTencent Cloud COS
- Create a bucket in the Tencent Cloud COS Console.
- Generate API credentials in the Tencent Cloud CAM Console.
- Refer to the Tencent Cloud COS Documentation for detailed instructions.
- Configure
object.cosinconfig/openim-rpc-third.yml:
# Bucket endpoint URL, e.g., https://temp-1252357374.cos.ap-chengdu.myqcloud.com
bucketURL:
# Secret ID for authentication
secretID:
# Secret key for authentication
secretKey:
# Session token (required only when using temporary STS credentials)
sessionToken:
# Public read mode. Recommended to keep false so download Content-Type and file names can be specified. If set to true, configure them in the COS console.
publicRead: falseQiniu KODO
- Create a bucket in the Qiniu Cloud KODO Console.
- Generate API keys in the Qiniu Cloud Key Management Console.
- Refer to the Qiniu Cloud Security Documentation for credential setup.
- Configure
object.kodoinconfig/openim-rpc-third.yml:
# Qiniu KODO regional endpoint, e.g., http://s3.cn-south-1.qiniucs.com
endpoint:
# Target bucket name
bucket: kodo-bucket-test
# Publicly accessible bucket domain, e.g., http://kodo-bucket-test-oetobfb.qiniudns.com
bucketURL:
# Access key ID
accessKeyID:
# Secret access key
accessKeySecret:
# Session token (required only when using temporary STS credentials)
sessionToken:
# Public read mode. Recommended to keep false to allow setting Content-Type and download file names.
publicRead: falseAmazon S3 (AWS)
- Review available endpoints in the AWS Regional Service Endpoints guide.
- Create an S3 bucket in the AWS S3 Console.
- Generate credentials in the AWS IAM Security Credentials Console.
- Refer to the Amazon S3 User Guide for configuration best practices.
- *Note: AWS S3 does not currently support dynamic thumbnail generation via URL parameters.*
- Configure
object.awsinconfig/openim-rpc-third.yml:
# Target AWS region identifier, e.g., us-east-1
region:
# Target bucket name
bucket:
# Access key ID
accessKeyID:
# Secret access key
secretAccessKey:
# Session token (required only when using temporary IAM session credentials)
sessionToken:
# Public read mode. Setting to true is currently unsupported for AWS S3.
publicRead: false