How to impement mod_http_upload from scratch?

1,166 views
Skip to first unread message

s.be...@student.vu.nl

unread,
Nov 16, 2017, 4:47:43 PM11/16/17
to Prosody IM Users
Hi,

implementing mod_http_upload should be as easy as adding it to  modules_enabled like other modules according to the prosody website. Eventually this does result to the default ports being open 5280 and 5281, but when using a client like profanity this "XEP-0363 HTTP File Upload is not supported by the server " still pops up when trying to send a file.

Is there a way to debug whether the mod_http_upload has been enable properly?

Using telnet to connect to the server and port number results in a successful connection. Is there another setting that I am forgetting, like actually running apache or anything on the server?

regards

Martin Honermeyer

unread,
Nov 16, 2017, 7:10:34 PM11/16/17
to prosod...@googlegroups.com
Hi,

you need to add the http_upload module (see https://github.com/djmaze/docker-prosody/blob/master/Dockerfile#L12-L13), enable the "http" module and configure the "http_upload" component (see https://github.com/djmaze/docker-prosody/blob/master/00prosody.cfg.lua#L24-L30). With the default settings, http will be available at port 5280. If you want to make the upload available via http, you need to run a https reverse proxy in front of it and adjust the "http_external_url" as shown in the example. 

This works fine for me.

Best

Am Do, 16. Nov, 2017 um 8:35 P. M. schrieb s.be...@student.vu.nl:
Hi,

implementing mod_http_ upload should be as easy as adding it to  modules_enabled like other modules according to the prosody website. Eventually this does result to the default ports being open 5280 and 5281, but when using a client like profanity this "XEP-0363 HTTP File Upload is not supported by the server " still pops up when trying to send a file.

Is there a way to debug whether the mod_http_upload has been enable properly?

Using telnet to connect to the server and port number results in a successful connection. Is there another setting that I am forgetting, like actually running apache or anything on the server?

regards

--
You received this message because you are subscribed to the Google Groups "Prosody IM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prosody-user...@googlegroups.com.
To post to this group, send email to prosod...@googlegroups.com.
Visit this group at https://groups.google.com/group/prosody-users.
For more options, visit https://groups.google.com/d/optout.

Martin Honermeyer

unread,
Nov 16, 2017, 7:11:50 PM11/16/17
to prosod...@googlegroups.com
Am Fr, 17. Nov, 2017 um 1:11 A. M. schrieb Martin Honermeyer <ma...@strahlungsfrei.de>:
If you want to make the upload available via http

Of course this should "https".

s.be...@student.vu.nl

unread,
Nov 17, 2017, 4:19:18 AM11/17/17
to Prosody IM Users
Hi Maze,

When checking netstat -tulpn I can see that port 5280 and 5281 are open.

I've downloaded the http_upload module and added it to the modules folder. Which was not there before, and still ports 5280 and 5281 were open.

http is enabled and I've configured the http_upload component like this:

Component "upload.domain.org" "http_upload"

http_upload_file_size_limit = 10 * 1024 * 1024
http_upload_expire_after = 60 * 60 * 24 * 7
http_upload_allowed_file_types = { "image/*", "text/plain" }

Now if I telnet to my server on port 5280 it connects. In the browser it's showing me a 404

Connecting with profanity client, I can still not send files and the same error pops up. What is a good way to debug?

regards



Op vrijdag 17 november 2017 01:10:34 UTC+1 schreef maze:

Matthew Wild

unread,
Nov 17, 2017, 5:20:28 AM11/17/17
to Prosody IM Users Group
On 17 November 2017 at 09:19, <s.be...@student.vu.nl> wrote:
> Hi Maze,
>
> When checking netstat -tulpn I can see that port 5280 and 5281 are open.
>
> I've downloaded the http_upload module and added it to the modules folder.
> Which was not there before, and still ports 5280 and 5281 were open.
>
> http is enabled and I've configured the http_upload component like this:

Just two minor things for the record:

- it's not recommended to put modules directly into Prosody's
modules folder. You should use plugin_paths and either point it to a
copy of prosody-modules, or a custom directory where you put modules
that you download. Modules put manually into Prosody's source
directory may be overwritten or broken without warning. Documentation
here:

- mod_http is automatically loaded when it is needed, and there is
no need to enable it manually

> Component "upload.domain.org" "http_upload"

> Connecting with profanity client, I can still not send files and the same
> error pops up. What is a good way to debug?

Is your user account on 'domain.org'? Auto-discovery by the client
will only work for direct subdomains. So if your user account is
something like "user...@domain.org", then "upload.domain.org" is
fine. But if your user account is "user...@chat.domain.org", then
"upload.domain.org" is not a direct subdomain and it won't work.

If that isn't the issue, I suggest you try with a different client, or
try to get some debug logs from Profanity.

Regards,
Matthew

s.be...@student.vu.nl

unread,
Nov 17, 2017, 5:34:21 AM11/17/17
to Prosody IM Users
Hi matthew,

I got this from the website when googling for "prosody plugin paths":

Your plugins directory contains all the optional modules that Prosody uses. Adding a module file (.lua) to this directory and then either commanding Prosody to load it, or adding it to modules_enabled in your config is enough to get Prosody using it.

The above is what I have done, is that incorrect?

Yes a user will connect with domain.org, so upload.domain.org is not the issue I believe.

I'm going to try and find some debug logs from profanity.

Thank you



Op vrijdag 17 november 2017 11:20:28 UTC+1 schreef Matthew Wild:

Matthew Wild

unread,
Nov 17, 2017, 5:43:03 AM11/17/17
to Prosody IM Users Group
On 17 November 2017 at 10:34, <s.be...@student.vu.nl> wrote:
> Hi matthew,
>
> I got this from the website when googling for "prosody plugin paths":

Eh, sorry, I forgot to put the link in my email :)

https://prosody.im/doc/installing_modules

The documentation you found via Google is technically correct, but not
the recommended approach now that plugin_paths exists (which was added
in Prosody 0.8 a long time ago). So thanks for bringing this to my
attention, I will update it.

And to be clear, what you did should definitely work, I was just
highlighting that it wasn't the recommended approach to installing
modules.

> I'm going to try and find some debug logs from profanity.

Ok, great! Let us know what you find.

Regards,
Matthew

s.be...@student.vu.nl

unread,
Nov 17, 2017, 10:45:43 AM11/17/17
to Prosody IM Users
Hi Matthew,

I was thinking... :) When visiting the web page upload.myserver.org:5280 the browser does not connect. but when visiting xmpp.myserver.org:5280 the browser shows me the 404 page. I think this might be where the problem lies. But I do not know where to look and what to change to get it right. would you mind showing me which steps to take to get it right?

this is what's in my config file

Component "upload.myserver.org" "http_upload"
http_external_url = "https://upload.myserver.org"

http_upload_file_size_limit = 10 * 1024 * 1024
http_upload_expire_after = 60 * 60 * 24 * 7
http_upload_allowed_file_types = { "image/*", "text/plain" }




I've checked the log of profanity when trying to send a file but it shows nothing interesting. I also mailed the developer, still waiting on answer to see if he can elaborate on how profanity connects to prosody server and how it checks for which modules are available.

regards




Op vrijdag 17 november 2017 11:43:03 UTC+1 schreef Matthew Wild:

Kim Alvefur

unread,
Nov 17, 2017, 11:09:56 AM11/17/17
to prosod...@googlegroups.com
Hi,

On Fri, Nov 17, 2017 at 07:45:43AM -0800, s.be...@student.vu.nl wrote:
> Component "upload.myserver.org" "http_upload"
> http_external_url = "https://upload.myserver.org"

The `http_external_url` option is for when you have a proxying HTTP
server in front of Prosody. Do you?

With this config, the client will be directed to
<https://upload.myserver.org/upload> so this is what you should look at.

--
Zash

s.be...@student.vu.nl

unread,
Nov 17, 2017, 11:29:49 AM11/17/17
to Prosody IM Users
Hi,


Op vrijdag 17 november 2017 17:09:56 UTC+1 schreef Kim Alvefur:
Hi,

On Fri, Nov 17, 2017 at 07:45:43AM -0800, s.be...@student.vu.nl wrote:
> Component "upload.myserver.org" "http_upload"
> http_external_url = "https://upload.myserver.org"

The `http_external_url` option is for when you have a proxying HTTP
server in front of Prosody. Do you?

Is this the mod_proxy65 you're referring too?

Kim Alvefur

unread,
Nov 17, 2017, 12:51:49 PM11/17/17
to prosod...@googlegroups.com
On Fri, Nov 17, 2017 at 08:29:48AM -0800, s.be...@student.vu.nl wrote:
> Hi,
>
>
> Op vrijdag 17 november 2017 17:09:56 UTC+1 schreef Kim Alvefur:
> >
> > Hi,
> >
> > On Fri, Nov 17, 2017 at 07:45:43AM -0800, s.be...@student.vu.nl
> > <javascript:> wrote:
> > > Component "upload.myserver.org" "http_upload"
> > > http_external_url = "https://upload.myserver.org"
> >
> > The `http_external_url` option is for when you have a proxying HTTP
> > server in front of Prosody. Do you?
> >
>
> Is this the mod_proxy65 you're referring too?

No, I mean something like Apache httpd or nginx set up to forward
connections on ports 80 or 443 to Prosodys built-in http server. It
sounds like you don't, which means the http_external_url will just break
everything for you. You should remove it.

--
Zash

s.be...@student.vu.nl

unread,
Nov 17, 2017, 5:45:10 PM11/17/17
to Prosody IM Users
Hi Zash,

you're right. I'm not running httpd on my xmpp server but I am running httpd on a webserver with the same domain name just not my xmpp server, which should have nothing to do with the xmpp server. 

I've removed the http_external_url.

But what is causing this url to work: http://xmpp.mydomain.org:5280 and showing the 404 page? What would cause the following not to work: http://upload.mydomain.org:5280

regards


Op vrijdag 17 november 2017 18:51:49 UTC+1 schreef Kim Alvefur:

Matthew Wild

unread,
Nov 17, 2017, 6:15:53 PM11/17/17
to Prosody IM Users Group

On 17 Nov 2017 22:45, <s.be...@student.vu.nl> wrote:
> But what is causing this url to work: http://xmpp.mydomain.org:5280 and showing the 404 page? What would cause the following not to work: http://upload.mydomain.org:5280

What do you get at the second URL? A 404 page? Prosody's 404 page or your httpd's?

Regards,
Matthew

s.be...@student.vu.nl

unread,
Nov 17, 2017, 6:19:18 PM11/17/17
to Prosody IM Users
Hi Matthew,

 on the second url I just get server not found. No 404

Op zaterdag 18 november 2017 00:15:53 UTC+1 schreef Matthew Wild:

s.be...@student.vu.nl

unread,
Nov 17, 2017, 6:30:36 PM11/17/17
to Prosody IM Users
I went on to change the component url for http_upload from upload.domain.org to xmpp.domain.org, which resulted in profanity showing me a different error.
I also restarted prosody instead of reloading.

before I changed from upload.domain.org to xmpp.domain.org i got this in profanity:

Uploading '/path/to/file' failed: Couldn't resolve host name

So I'm finally seeing a different error (lucky me). Now I'm getting:

Uploading '/Users/johndoe/Desktop/f.png' failed: Peer certificate cannot be authenticated with given CA
           certificates

regards




Now instead of reloading prosody I restarted it

Op zaterdag 18 november 2017 00:19:18 UTC+1 schreef s.be...@student.vu.nl:

Matthew Wild

unread,
Nov 18, 2017, 1:46:35 AM11/18/17
to Prosody IM Users Group
On 17 November 2017 at 23:30, <s.be...@student.vu.nl> wrote:
> I went on to change the component url for http_upload from upload.domain.org
> to xmpp.domain.org, which resulted in profanity showing me a different
> error.
> I also restarted prosody instead of reloading.
>
> before I changed from upload.domain.org to xmpp.domain.org i got this in
> profanity:
>
> Uploading '/path/to/file' failed: Couldn't resolve host name

You said that the browser said "server not found", and profanity says
this. Did you add a DNS record for this domain (upload.mydomain.org)?
Without one, nothing will work. No software will be able to determine
which server to connect to for your URLs.

Regards,
Matthew

s.be...@student.vu.nl

unread,
Nov 18, 2017, 2:34:21 PM11/18/17
to Prosody IM Users
Hi Matthew,

thank for your previous message. Made a rookie mistake.. It all makes sense now.

You were right that I did not have a DNS A record setup for upload.domain.org, that's why I also got the following error in profanity when trying to send a file:

Uploading '/path/to/file' failed: Couldn't resolve host name

I also had some other errors I dealt with, involving apache, certbot, sub domain server certificate  and the configuration of https_ssl in the prosody config file. Would it be a good place to describe what I did here?

regards


Op zaterdag 18 november 2017 07:46:35 UTC+1 schreef Matthew Wild:
Reply all
Reply to author
Forward
0 new messages