[ejabberd] how to reverse proxy mod_http_upload with nginx?

pitchum pitchum at gramaton.org
Fri Oct 27 18:02:50 MSK 2017

Le 27/10/2017 à 14:57, Holger Weiß a écrit :
> * pitchum <pitchum at gramaton.org> [2017-10-27 14:48]:
>> Le 27/10/2017 à 14:38, Holger Weiß a écrit:
>>> The 'put_url' is what you think of as the 'external_url': It's sent
>>> to the client as the upload slot to use and can be served by Nginx.
>>> I.e., you can just specify something like this:
>>>   put_url: "https://jabber.example.net/upload"
>> Doing this prevents ejabberd from starting. I guess this is because
>> ejabberd tries to spawn its own HTTP server to listen on port 443
>> which is already used by nginx.
> No.  ejabberd spawns only those listening sockets that you configured
> in the 'listen:' block.
>> 2017-10-27 14:41:46.324 [critical] <0.247.0>@gen_mod:start_module:212
>> Problem starting the module mod_http_upload for host jabber.example.net
>>  options: [{put_url,<<"https://jabber.example.net/upload">>},
>>            {get_url,<<"https://jabber.example.net/data">>},
>>            {docroot,<<"/srv/ejabberd/upload">>},
>>            {thumbnail,false}]
>>  error: {error,{already_started,<0.483.0>}}
> My guess is that you're using the same put_url for multiple virtual
> hosts.  This is currently not supported.

You're right. I was not aware of that. Indeed since my modules are
configured globally they apply to all vhosts. I removed the second vhost
(this was a test) and now ejabberd is able to start.
Thank you, you saved my day!

> Is there a reason you're still using a get_url that's different from
> the put_url, by the way?

Yes, I want nginx to respond to GET requests directly, like this:

    location /data {
        alias /srv/ejabberd/upload;
    location /upload {
        proxy_pass http://example.net:5280/upload;
        include proxy_params;

Now everything works as expected. Thanks again!


More information about the ejabberd mailing list