Getting strophe to work with prosody and crossdomain.xml

574 views
Skip to first unread message

Barnettech

unread,
Jun 28, 2012, 1:14:52 PM6/28/12
to str...@googlegroups.com
Hello,

Any help would be very appreciated.  We're trying to get Strophe to work with prosody but can't use CORS because we need to be compatible with our Internet Explorer 7 users.  So we are trying to use flXHR and crossdomain.xml but every thing we try fails and strophe's log returns the error message:

NetworkError: 404 Not Found - http://bosh.babson.edu:5280/crossdomain.xml

And crossdomain.xml is being served at http://bosh.babson.edu:5280/http-bind/crossdomain.xml but we can't seem to get it to stop looking for crossdomain.xml anywhere other than in the root directory.

So how can we move crossdomain.xml being served up by Prosody or how can we change it so it knows to look for crossdomain.xml in at the correct path (http://bosh.babson.edu:5280/http-bind/crossdomain.xml)

Thank you,

James

Matthew Wild

unread,
Jun 30, 2012, 11:35:56 AM6/30/12
to str...@googlegroups.com
Hi James,

Sorry I only just got to this post...

On 28 June 2012 18:14, Barnettech <barne...@gmail.com> wrote:
> Hello,
>

> So how can we move crossdomain.xml being served up by Prosody or how can we
> change it so it knows to look for crossdomain.xml in at the correct path
> (http://bosh.babson.edu:5280/http-bind/crossdomain.xml)

I'm not even entirely sure how you got Prosody to serve it there in
the first place! What version of Prosody are you using? Can you
describe your setup a bit?

Regards,
Matthew

Jack Moffitt

unread,
Jun 30, 2012, 8:22:59 PM6/30/12
to str...@googlegroups.com




NetworkError: 404 Not Found - http://bosh.babson.edu:5280/crossdomain.xml

And crossdomain.xml is being served at http://bosh.babson.edu:5280/http-bind/crossdomain.xml but we can't seem to get it to stop looking for crossdomain.xml anywhere other than in the root directory.



Flash mandates that crossdomain.xml be served from the root.

jack.

Barnettech

unread,
Jul 3, 2012, 9:35:44 AM7/3/12
to str...@googlegroups.com
It is just the most recent version of Prosody.  By default when you go to the root directory looking for crossdomain.xml it just says "not here :(" so I tried the url putting the http-bind in there and it responds:  You really don't look like a BOSH client to me... what do you want?

Matthew Wild

unread,
Jul 3, 2012, 9:51:07 AM7/3/12
to str...@googlegroups.com
On 3 July 2012 14:35, Barnettech <barne...@gmail.com> wrote:
> It is just the most recent version of Prosody. By default when you go to
> the root directory looking for crossdomain.xml it just says "not here :(" so
> I tried the url putting the http-bind in there and it responds: You really
> don't look like a BOSH client to me... what do you want?
>

I learnt some time ago that "the most recent version of X" can mean
different things to different people :) But ok, I'll assume 0.8.2.

You need to enable mod_httpserver, just uncomment "httpserver" in the
config file. Add to the config just below this (and above any
VirtualHost or Component lines in the config): http_path =
"/path/to/serve"

Where "/path/to/serve" is a directory containing crossdomain.xml and
anything else you wish Prosody to serve over HTTP. In Prosody 0.8.2
you should then be able to access
http://yourprosody:5280/crossdomain.xml .

If it doesn't work then check these things:

- Prosody version is 0.8.2
- Directory is specified correctly in the config
- http_path is *not* specified in the config under a VirtualHost or
Component, but above all of them
- Prosody has permission to read from the directory you specified on
the filesystem

Hope this helps,
Matthew

Barnettech

unread,
Jul 3, 2012, 10:04:25 AM7/3/12
to str...@googlegroups.com
do you have to manually place a crossdomain.xml file in the root directory?  Or does Prosody generate one for you?  (probably a newbie question for sure).  And if you have to manually place the file, where on the filesystem is the "root" directory in Prosody's eyes?

thanks.

Matthew Wild

unread,
Jul 3, 2012, 10:32:39 AM7/3/12
to str...@googlegroups.com
On 3 July 2012 15:04, Barnettech <barne...@gmail.com> wrote:
> do you have to manually place a crossdomain.xml file in the root directory?
> Or does Prosody generate one for you? (probably a newbie question for
> sure). And if you have to manually place the file, where on the filesystem
> is the "root" directory in Prosody's eyes?
>

Prosody doesn't generate one, though I can put together a plugin for
it if you send me your desired crossdomain.xml file (but at that point
we should probably take this discussion off-list). Take a look at
http://bosh.metajack.im:5280/crossdomain.xml for example if you don't
have one already.

The 'root' directory is specified by the http_path configuration
option, as described in my previous email.

Regards,
Matthew

Barnettech

unread,
Jul 3, 2012, 10:51:45 AM7/3/12
to str...@googlegroups.com
thanks.  The root directory is specified by the http_path configuration but if I just put in "/" so it serves from the root directory is it assumed that on the actual file system this is in the same place as the Prosody executable?  I'm working with our sys admin here and this is his question.

Thank you again.

James

Barnettech

unread,
Jul 3, 2012, 11:19:46 AM7/3/12
to str...@googlegroups.com
Ok got it working.... now onto the next error trying to connect to GTALk we're getting a service-unavailable error message now if anyone knows the problem?:

<body rid='9355299560009' xmlns='http://jabber.org/protocol/httpbind' sid='0428d669-62c2-4a6c-b092-b6c44744d7f2'><iq type='get' xmlns='jabber:client' id='5740:sendIQ'><query xmlns='jabber:iq:roster'/></iq><presence type='unavailable' xmlns='jabber:client'/><presence type='available' xmlns='jabber:client'/></body>
strophe.js?X (line 2188)
<body xmlns='http://jabber.org/protocol/httpbind' sid='0428d669-62c2-4a6c-b092-b6c44744d7f2' xmlns:stream='http://etherx.jabber.org/streams'><iq id='5740:sendIQ' type='error' xmlns='jabber:client'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq></body>
strophe.js?X (line 2170)
<body rid='9355299560010' xmlns='http://jabber.org/protocol/httpbind' sid='0428d669-62c2-4a6c-b092-b6c44744d7f2'/>
strophe.js?X (line 2188)
<body xmlns='http://jabber.org/protocol/httpbind' sid='0428d669-62c2-4a6c-b092-b6c44744d7f2' xmlns:stream='http://etherx.jabber.org/streams'><presence xmlns='jabber:client' type='error'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence><presence xmlns='jabber:client' type='error'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence></body>
strophe.js?X (line 2170)
<body rid='9355299560011' xmlns='http://jabber.org/protocol/httpbind' sid='0428d669-62c2-4a6c-b092-b6c44744d7f2'/>

Matthew Wild

unread,
Jul 3, 2012, 12:50:26 PM7/3/12
to str...@googlegroups.com
On 3 July 2012 16:19, Barnettech <barne...@gmail.com> wrote:
> Ok got it working.... now onto the next error trying to connect to GTALk
> we're getting a service-unavailable error message now if anyone knows the
> problem?:

You are sending these stanzas:

- <iq type='get' id='5740:sendIQ'>
<query xmlns='jabber:iq:roster'/>
</iq>
- <presence type='unavailable'/>
- <presence type='available'/>

And getting these responses to them (same order):

- <iq id='5740:sendIQ' type='error'>
<error type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
- <presence type='error'>
<error type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>
- <presence type='error'>
<error type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</presence>

The roster get looks fine, but Prosody says it can't handle it. I can
think of two reasons this might be:

- mod_roster is not loaded in the Prosody config (it is by default)
- You have not authenticated yet

The second presence (type=unavailable) also looks fine, though I don't
know why you would send it during login. Prosody also complains about
it, suggesting either:

- mod_presence is not loaded (it is by default)
- You have not authenticated yet

The third presence stanza you send (type=available) is invalid, and so
an error is expected. 'available' is not a valid presence type, simply
omit the 'type' attribute for available presence.

Regards,
Matthew

Barnettech

unread,
Jul 3, 2012, 1:15:20 PM7/3/12
to str...@googlegroups.com
ok so regarding prosody authentication:

To get my stuff working with the metajack server I did this:

(this is PHP code)
$thepw = base64_encode($jid . chr(0) . $username . chr(0) . $password);
and then sent the xml stanza as:
$xmlposts[] = '<body rid="' . $_jabber_rid_ . '" xmlns="http://jabber.org/protocol/httpbind" sid="' . $_jabber_sid_ . '"><auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">' . $thepw . '</auth></body>';

then on the prosody authentication documentation I see:  http://prosody.im/doc/authentication
so is the problem I'm still sending it through with the base64_encode() ?

Do I need to change the authentication from the default of internal_plain?  And will Prosody accept the base64_encode?

Maybe I'm just not authenticating then?

Matthew Wild

unread,
Jul 3, 2012, 1:29:06 PM7/3/12
to str...@googlegroups.com
On 3 July 2012 18:15, Barnettech <barne...@gmail.com> wrote:
> ok so regarding prosody authentication:
>
> To get my stuff working with the metajack server I did this:
>
> (this is PHP code)
> $thepw = base64_encode($jid . chr(0) . $username . chr(0) . $password);
> and then sent the xml stanza as:
> $xmlposts[] = '<body rid="' . $_jabber_rid_ . '"
> xmlns="http://jabber.org/protocol/httpbind" sid="' . $_jabber_sid_ .
> '"><auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">' .
> $thepw . '</auth></body>';

In general you should leave the authzid empty, so the base64_encode
line should be:

$thepw = base64_encode(chr(0) . $username . chr(0) . $password);

I don't know if this is your problem, however.

> then on the prosody authentication documentation I see:
> http://prosody.im/doc/authentication
> so is the problem I'm still sending it through with the base64_encode() ?

That page lists the authentication backends that Prosody supports, and
is largely unrelated to the protocol you use to authenticate (all of
them support PLAIN, which you are using).

> Do I need to change the authentication from the default of internal_plain?

No, as long as you have created the user account (
http://prosody.im/doc/creating_accounts ) then it doesn't matter what
authentication backend you use.

> And will Prosody accept the base64_encode?

Yes, though try the change to it that I suggested above.

> Maybe I'm just not authenticating then?

I can't tell - there was no authentication in the logs you pasted in
your previous email.

One further possibility is that Prosody is denying your use of PLAIN
because your connection is unencrypted. This is a sensible security
measure recommended by the XMPP specifications. Make sure your
connection is encrypted, or disable this check with *either* of these
config options:

allow_unencrypted_plain_auth = true -- Allow PLAIN on all
unencrypted connections
-- Or...
consider_bosh_secure = true -- Pretend that BOSH sessions are
encrypted (useful behind an SSL-terminating reverse proxy)

Regards,
Matthew

Barnettech

unread,
Jul 3, 2012, 1:39:02 PM7/3/12
to str...@googlegroups.com
Ok so this is the newbie gotcha probably.  We are not using Prosody as our jabber server.  We are actually using GTALK.  We have the DNS setup right and I know this because we can use our php / strophe application successfully with GTALK when pointing to the metajack bosh server.  

Can Prosody be used to connect to GTALK and if so did we have to configure it to do so?

Thanks.

Matthew Wild

unread,
Jul 3, 2012, 2:15:56 PM7/3/12
to str...@googlegroups.com
On 3 July 2012 18:39, Barnettech <barne...@gmail.com> wrote:
> Ok so this is the newbie gotcha probably. We are not using Prosody as our
> jabber server. We are actually using GTALK. We have the DNS setup right
> and I know this because we can use our php / strophe application
> successfully with GTALK when pointing to the metajack bosh server.
>
> Can Prosody be used to connect to GTALK and if so did we have to configure
> it to do so?

Hmm, depends what you mean by "connect to GTALK", but likely the
answer is "no". Prosody is an XMPP server in its own right. Once you
log into your account *on Prosody* you can then communicate with JIDs
on any XMPP service that federates (including Google's).

What you *can't* do is use Prosody (or ejabberd, or other standard
XMPP servers) to connect and log into other XMPP servers. For that
kind of thing you want a standalone BOSH connection manager. I haven't
used one for a long time so I don't know what the current state of the
art is, but Punjab is a good example.

Regards,
Matthew

Barnettech

unread,
Jul 3, 2012, 2:34:15 PM7/3/12
to str...@googlegroups.com
thanks.  yes not the right server type.  I found this one which runs in node.js and there is a list at the bottom of the page https://github.com/dhruvbird/node-xmpp-bosh

thanks for all your help.

Charlie Garrison

unread,
Jul 3, 2012, 4:50:31 PM7/3/12
to str...@googlegroups.com
Good morning,

On 3/07/12 at 2:51 PM +0100, Matthew Wild <mwi...@gmail.com> wrote:

>I learnt some time ago that "the most recent version of X" can mean
>different things to different people :) But ok, I'll assume 0.8.2.

Yep, and even worse is looking at the archives, seeing a post
from 6 months ago saying "the most recent version", but how the
hell am I supposed to know (without a lot of research) what the
most recent version was on a given date.

Please everyone, quote version numbers. They are unambiguous and
no one has to make any assumptions before they are able to offer
their own time to help you.


Charlie

--
Ꮚ Charlie Garrison ♊ <garr...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

Reply all
Reply to author
Forward
0 new messages