Unable to Upload files in chat using MongooseIM as server and mod_http_upload module

414 Views Asked by At

After configuring the module and restarting the server, I can see the HTTP upload is enabled at the server end by using an XMPP client. But when I try to upload, it doesn't upload the file and it throws a timeout exception. I'm using Xabber mobile app on android as a client. Here is the config I'm using.

{mod_http_upload, [   {host, upload.@HOST@},   {backend, s3},   {expiration_time, 600}, % play.minio.io's clock is skewed by few minutes   {s3, [
        {bucket_url, "http://server.com:9000/bucket/"},
        {add_acl, false},
        {region, "us-east-1"},
        {access_key_id, "JWlsdfKd"},
        {secret_access_key, "3dz8jasdrtyv678ytfZh20qb5cG2qd"}   ]} ]}

Please help where I'm missing.

2

There are 2 best solutions below

5
michalwski On

It looks like the configuration is not fully correct. I assume that you use MongooseIM 3.6 or newer and min.io as the file storage. Could you try the following configuration:

  {mod_http_upload, [
        {host, "upload.@HOST@"},
        {backend, s3},
        {expiration_time, 600}, % play.minio.io's clock is skewed by few minutes
        {s3, [
              {bucket_url, "http://server.com:9000/bucket/"},
              {add_acl, false},
              {region, "us-east-1"},
              {access_key_id, "JWlsdfKd"},
              {secret_access_key, "3dz8jasdrtyv678ytfZh20qb5cG2qd"}
             ]}
  ]}

Also, if you use MongooseIM from master (or docker's latest tag) we recently updated our documentation with some tips how to quickly check if HTTP file upload works correctly, you can find it at https://mongooseim.readthedocs.io/en/latest/modules/mod_http_upload/

1
Piotr Nosek On

Please try to replace {host, upload.@HOST@} with {host, "upload.@HOST@"} - I'm surprised this mistake hasn't been rejected on config load TBH, as I'm pretty sure it should have caused a syntax error.