Serving crossdomain.xml problem

Hello. I'm trying to follow the example in Chpt. 8 of the "Professional XMPP Programming with JavaScript and JQuery" book. In this chapter, the author is demonstrating how to build a multiuser chat using ejabberd's bosh implementation and the strophe.js library.

My problem is that the example calls for the use of a flash component (flHXR) to get around cross domain issues. When I try to follow the author's example (in earlier chapter) on how to set ejabberd up to serve the crossdomain.xml, it breaks everything else (like admin web access, and the BOSH test page "/http-bind").

Here's my particulars:
ejabberd 2.1.8 (installed from the linux installer) (in working order when using clients like adium and mcabber)
system os is Ubuntu 9 (Karmic)

from the ejabberd.cfg (which will allow admin web access, bosh test page, but a 404 error for crossdomain.xml):

{5280, ejabberd_http, [
                http_poll,
                web_admin,
                http_bind,
               {request_handlers, [
                       {["web"], mod_http_fileserver}
               ]}
]}

{mod_http_fileserver, [
    {docroot, "/opt/ejabberd-2.1.8/www"},
    {accesslog, "/opt/ejabberd-2.1.8/www/webaccess.log"},
    {content_types, [{".xml", "text/xml"}, {".htm", "text/html"}]},
    {directory_indices, ["index.html", "index.htm"]}
  ]},

-----
if I change the 5280 section above to:

{5280, ejabberd_http, [
                       web_admin,
                       {request_handlers, [{[“ xmpp-httpbind”] ,
                                            mod_http_bind} ,
                                           {[] , mod_http_fileserver}] }
                      ] }

Web admin access no longer works, the BOSH test page no longer works and I get a 404 from http://server.domain.com:5280/crossdomain.xml.
There is a crossdomain.xml in /opt/ejabberd-2.1.8/www that is readable by ejabberd process.

Here's the ejabberd.log output from the request with the second 5280 section in use:

=INFO REPORT==== 2011-08-01 15:41:01 ===
I(<0.1156.0>:ejabberd_listener:281) : (#Port<0.1340>) Accepted connection {{133,253,13,33},62882} -> {{133,253,83,93},5280}

=INFO REPORT==== 2011-08-01 15:41:01 ===
D(<0.1178.0>:ejabberd_http:141) : S: [{["xmpp-httpbind"],mod_http_bind},
                                      {[],mod_http_fileserver},
                                      {["admin"],ejabberd_web_admin}]

=INFO REPORT==== 2011-08-01 15:41:01 ===
I(<0.1178.0>:ejabberd_http:143) : started: {gen_tcp,#Port<0.1340>}

=INFO REPORT==== 2011-08-01 15:41:01 ===
D(<0.1178.0>:ejabberd_http:260) : (#Port<0.1340>) http query: 'GET' /crossdomain.xml

=INFO REPORT==== 2011-08-01 15:41:01 ===
D(<0.1178.0>:ejabberd_http:329) : ["crossdomain.xml"] matches []

=INFO REPORT==== 2011-08-01 15:41:01 ===
D(<0.1178.0>:mod_http_fileserver:299) : Requested ["crossdomain.xml"]

=ERROR REPORT==== 2011-08-01 15:41:01 ===
E(<0.1178.0>:mod_http_fileserver:306) : Received an HTTP request with Host "s323.foo.org", but couldn't find the related ejabberd virtual host

=INFO REPORT==== 2011-08-01 15:41:01 ===
D(<0.1178.0>:ejabberd_http:260) : (#Port<0.1340>) http query: 'GET' /favicon.ico

=INFO REPORT==== 2011-08-01 15:41:01 ===
D(<0.1178.0>:ejabberd_http:329) : ["favicon.ico"] matches []

=INFO REPORT==== 2011-08-01 15:41:01 ===
D(<0.1178.0>:mod_http_fileserver:299) : Requested ["favicon.ico"]

=ERROR REPORT==== 2011-08-01 15:41:01 ===
E(<0.1178.0>:mod_http_fileserver:306) : Received an HTTP request with Host "s323.foo.org", but couldn't find the related ejabberd virtual host

I've googled all over the place and most hits are years old. I've tried many proffered solutions, but with no success.

Can anyone help point me in the right direction?

Thanks.

foobarius wrote: Here's the

foobarius wrote:

Here's the ejabberd.log output from the request with the second 5280 section in use:

=ERROR REPORT==== 2011-08-01 15:41:01 ===
E(<0.1178.0>:mod_http_fileserver:306) : Received an HTTP request with Host "s323.foo.org", but couldn't find the related ejabberd virtual host

I've googled all over the place and most hits are years old. I've tried many proffered solutions, but with no success.

Have you read that error report? It says that you have in ejabberd.cfg something like
{hosts, ["server.domain.com"]}.
But you send the HTTP query indicating s323.foo.org as Host destination.

foobarius wrote:

if I change the 5280 section above to:

{5280, ejabberd_http, [
                       web_admin,
                       {request_handlers, [{["xmpp-httpbind"], mod_http_bind} ,
                                           {[], mod_http_fileserver}] }
                      ] }

Web admin access no longer works, the BOSH test page no longer works and I get a 404 from http://server.domain.com:5280/crossdomain.xml.
There is a crossdomain.xml in /opt/ejabberd-2.1.8/www that is readable by ejabberd process.

This configuration works for me:

  {5280, ejabberd_http, [
                         {request_handlers, [
                           {["http-bind"], mod_http_bind},
                           {["admin"], ejabberd_web_admin},
                           {[], mod_http_fileserver}
                         ]}
                        ]},
$ lynx -mime_header http://localhost:5280/crossdomain.xml                                                           
HTTP/1.0 200 OK
Connection: close
Content-Length: 39
Server: ejabberd
Last-Modified: Tue, 02 Aug 2011 15:25:46 GMT
Content-Type: application/xml

This is just a dummy crossdomain file.
$ lynx -mime_header http://localhost:5280/admin/                                                                 
HTTP: Access authorization required.
       Use the -auth=id:pw parameter.

Looking up localhost:5280
Making HTTP connection to localhost:5280
Sending HTTP request.
HTTP request sent; waiting for response.
Alert!: Access without authorization denied -- retrying

lynx: Can't access startfile http://localhost:5280/admin/
$ lynx -mime_header http://localhost:5280/http-bind/                                                                 
HTTP/1.0 200 OK
Connection: close
Content-Length: 502
Content-Type: text/xml; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type

<?xml version='1.0'?>

ejabberd mod_http_bind...
Syndicate content