Module Description

This module implements XEP-0363: HTTP File Upload. It enables a service that on user request creates an upload "slot". A slot is a pair of URLs, one of which can be used with PUT method to upload user's file, the other with GET method to retrieve the file.

Currently, the module supports only S3 backend using AWS Signature Version 4.


  • host (string, default: "upload.@HOST@"): Subdomain for upload service to reside under. @HOST@ is replaced with each served domain.
  • backend (atom, default: s3) - Backend to use for generating slots. Currently only s3 can be used.
  • expiration_time (integer, default: 60) - Duration (in seconds) after which the generated PUT URL will become invalid.
  • token_bytes (integer, default: 32) - Number of random bytes of a token that will be used in a generated URL. The text representation of the token will be twice as long as the number of bytes, e.g. for the default value the token in URL will be 64 characters long.
  • max_file_size (integer, default: 10 MB) - Maximum file size (in bytes) accepted by the module. Disabled if set to undefined.
  • s3 (list, default: unset) - Options specific to S3 backend.

S3 backend options

  • bucket_url (string, default: unset) - A complete URL pointing at the used bucket. The URL may be in virtual host form, and for AWS needs to point at a specific regional endpoint for the bucket. The scheme, port and path specified in the URL will be used to create PUT URLs for slots, e.g. specifying a value of "" will result in PUT URLs of form "<RANDOM_TOKEN>/<FILENAME>?<AUTHENTICATION_PARAMETERS>".
  • region (string, default: unset) - The AWS region to use for requests.
  • access_key_id (string, default: unset) - ID of the access key to use for authorization.
  • secret_access_key (string, default: unset) - Secret access key to use for authorization.

Example configuration

{mod_http_upload, [
        {host, "upload.@HOST@"},
        {backend, s3},
        {expiration_time, 120},
        {s3, [
              {bucket_url, ""},
              {region, "eu-west-1"},
              {access_key_id, "AKIAIOSFODNN7EXAMPLE"},
              {secret_access_key, "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}