[ejabberd] SOLVED Re: mod_http_fileserver only returns 404

Aaron Brashears aaron at stageit.com
Sat Sep 18 00:24:00 MSD 2010


Hi again. I have figured this one out. From what I can tell, it
appears that mod_http_fileserver matches on the HTTP Host header. As I
was modifying the configuration and watching the log over restarts I
noticed that the number of fileservers started matched the number of
hosts in the {hosts, [...]} tagged list.

Adding all of the domains served (some are in dns while some are not)
fixed the problem for all of our use cases.


I was not able to figure how this works. From reading
web/mod_http_fileserver.erl it looks like init creates one process for
serving files specific to a particular host. What spawns the processes
at one per host? Is that the general case for all modules in ejabberd?


On Thu, Sep 16, 2010 at 4:09 PM, Aaron Brashears <aaron at stageit.com> wrote:
> Hi there. I am in the process of configuring our ejabberd 2.1.2 server
> to allow connections from our web application over bosh from some kind
> of flash widget. As such, our front end dev has asked for ejabberd to
> serve up a crossdomain.xml file so that the flash socket will work
> appropriately.
>
> I have configured ejabberd_http in the listening ports section to be
> quite standard:
>
>  {5280, ejabberd_http, [
>                         {request_handlers,
>                          [
>                           {["public"], mod_http_fileserver}
>                          ]},
>                         http_bind,
>                         http_poll,
>                         web_admin
>                        ]}
>
> And Nothing surprising in the modules section where I enable and
> configure mod_http_fileserver:
>
>  {mod_http_fileserver, [
>                         {docroot, "/var/www/ejabberd"},
>                         {accesslog, "/var/log/ejabberd/access.log"},
>                         {directory_indices, ["index.html"]},
>                         {content_types, [{".html", "text/html"},
>                                          {".xml", "text/xml"}
>                                         ]}
>                        ]},
>
> In /var/www/ejabberd (world readable, root writable), I have placed
> both an index.html and crossdomain.xml file. When I issue a GET to
> localhost:5280/public/crossdomain.xml, I get a 404 instead of my
> document.
>
> $ curl -v http://localhost:5280/public/crossdomain.xml
>> GET /public/crossdomain.xml HTTP/1.1
>> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
>> Host: localhost:5280
>> Accept: */*
>>
> < HTTP/1.1 404 Not Found
> < Content-Type: text/html; charset=utf-8
> < Content-Length: 334
> ...
>
> I have tried shuffling files, permissions, ownerships, paths, module
> order, and all with never anything besides a 404.
> /var/log/ejabberd/access.log is always empty and if I turn on debug
> logging in ejabberd.cfg, the following logs are emitted to
> ejabberd.log:
>
> =INFO REPORT==== 2010-09-16 16:05:49 ===
> I(<0.361.0>:ejabberd_listener:232) : (#Port<0.3538>) Accepted
> connection {{127,0,0,1},53736} -> {{127,0,0,1},5280}
>
> =INFO REPORT==== 2010-09-16 16:05:49 ===
> D(<0.379.0>:ejabberd_http:135) : S: [{["public"],mod_http_fileserver},
>                                     {["admin"],ejabberd_web_admin},
>                                     {["http-bind"],mod_http_bind},
>                                     {["http-poll"],ejabberd_http_poll}]
>
>
> =INFO REPORT==== 2010-09-16 16:05:49 ===
> I(<0.379.0>:ejabberd_http:137) : started: {gen_tcp,#Port<0.3538>}
>
> =INFO REPORT==== 2010-09-16 16:05:49 ===
> D(<0.379.0>:ejabberd_http:254) : (#Port<0.3538>) http query: 'GET'
> /public/crossdomain.xml
>
>
> =INFO REPORT==== 2010-09-16 16:05:49 ===
> D(<0.379.0>:ejabberd_http:322) : ["public","crossdomain.xml"] matches ["public"]
>
> =INFO REPORT==== 2010-09-16 16:05:49 ===
> D(<0.379.0>:mod_http_fileserver:294) : Requested ["crossdomain.xml"]
>
>
>
> So from my understanding, GET /public/ should map to /var/www/ejabberd
> and the crossdomain.xml should be served from that directory. I hate
> asking such a silly question and I'm wondering if anyone has seen
> anything like this.
>


More information about the ejabberd mailing list