strophe and chrome

114 views
Skip to first unread message

gengstrand

unread,
Sep 16, 2011, 5:51:21 PM9/16/11
to Strophe
I am having trouble using strophe to connect to a Tigase server. All
is well when I use firefox but when I use chrome, I get this...

2011-09-16 14:30:45 ConnectionManager.serviceStarted() FINER:
[[bosh]] Connection started:
192.168.130.105_6202_10.200.128.222_62539, type: accept, Socket:
Socket[addr=/10.200.128.222,port=62539,localport=6202]2011-09-16

Eventually, I see this in the Tigase debug log when I close the
browser or navigate away from the page.

14:31:43 ConnectionManager.serviceStopped() FINER: [[bosh]]
Connection stopped: 192.168.130.105_6202_10.200.128.222_62539, type:
accept, Socket: Socket[unconnected]

When I use firefox, I get this.

2011-09-16 14:32:06 ConnectionManager
$ConnectionListenerImpl.accept() FINEST: Accept called for service:
null@null
2011-09-16 14:32:06 ConnectionManager.serviceStarted() FINER:
[[bosh]] Connection started:
192.168.130.105_6202_10.200.128.222_62557, type: accept, Socket:
Socket[addr=/10.200.128.222,port=62557,localport=6202]
2011-09-16 14:32:06 BoshConnectionManager.processSocketData() FINER:
Processing packet: body, type: null
2011-09-16 14:32:06 BoshConnectionManager.processSocketData()
FINEST: Processing socket data: from=null, to=null, DATA=<body
content="text/xml; charset=utf-8" wait="60" xmpp:version="1.0"
to="localhost" rid="1261947845" xmlns="http://jabber.org/protocol/
httpbind" hold="1" xml:lang="en" xmlns:xmpp="urn:xmpp:xbosh" ver="1.6"/
>, SIZE=226, XMLNS=http://jabber.org/protocol/httpbind,
PRIORITY=NORMAL, PERMISSION=NONE, TYPE=null

On the strophe side, the onConnect handler fires with status =
Strophe.Status.CONNECTING but nothing else ever fires after that.

It looks to me like chrome will open the connection but never send the
initial request. This is before Tigase sends the CORS headers in the
response. What gives? Has anyone else had any success using strophe to
connect to Tigase on chrome?

gengstrand

unread,
Sep 16, 2011, 6:01:54 PM9/16/11
to Strophe
Connecting via strophe on chrome works fine when I disable-web-
security. The chat server is on a different machine than the web
server but I still don't see how this can be a CORS issue.

Jack Moffitt

unread,
Sep 16, 2011, 7:38:05 PM9/16/11
to str...@googlegroups.com
> Connecting via strophe on chrome works fine when I disable-web-
> security. The chat server is on a different machine than the web
> server but I still don't see how this can be a CORS issue.

If the hostname or the port (or both) is different, then it is a cross
domain request. You should be able to look at the resources view in
the web inspector of Chrome and find out what it says about your
request. Is it blocking it?

What headers does the BOSH endpoint return when you hit it with curl?

jack.

gengstrand

unread,
Sep 17, 2011, 6:12:16 PM9/17/11
to Strophe
curl --include --data-binary '<body xmpp:version="1.0" xmlns="http://
jabber.org/protocol/httpbind" hold="1" content="text/xml;
charset=utf-8" rid="1054090768" xml:lang="en" ver="1.6"
xmlns:xmpp="urn:xmpp:xbosh" to="ec2-hidden.compute-1.amazonaws.com"
wait="60"/>' ec2-hidden.compute-1.amazonaws.com:5280/xmpp-httpbind
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 400
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type
Access-Control-Max-Age: 86400
Server: Tigase Bosh/5.1.0-beta3-b2667

<body sid="703e4036-2b83-4f78-9605-bf633acc5df5" hold="1"
authid="09f4bb17-252a-425a-b131-f954ac3826b0" secure="true" from="ec2-
hidden.compute-1.amazonaws.com" ver="1.6" requests="2" wait="30"
xmlns:stream="http://etherx.jabber.org/streams" inactivity="10"
ack="1054090768" xmlns:xmpp="urn:xmpp:xbosh" polling="10"
maxpause="10" xmpp:version="1.0" xmlns="http://jabber.org/protocol/
httpbind"/>

Jack Moffitt

unread,
Sep 21, 2011, 6:19:39 PM9/21/11
to str...@googlegroups.com
Those look correct to me. You might ask on the Tigase list if they
have any ideas. You could also double check your code by using my
test bosh endpoint at http://bosh.metajack.im:5280/xmpp-httpbind
assuming your server is reachable from the internet. If it works with
that, then it's probably a subtle CORS issue or some incompatibility
with Tigase.

jack.

> --
> You received this message because you are subscribed to the Google Groups "Strophe" group.
> To post to this group, send email to str...@googlegroups.com.
> To unsubscribe from this group, send email to strophe+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/strophe?hl=en.
>
>

gengstrand

unread,
Sep 22, 2011, 11:23:45 AM9/22/11
to Strophe
I agree with you Jack in that curl is showing what is compliant with
standards, both BOSH and CORS. That, and the fact that chrome can
connect with security disabled, leads me to believe that Google's
interpretation of the CORS spec is unique and different from both
Mozilla's, Apple's, and Microsoft's. I am kind of surprised about
that. I believe that neither Tigase nor Strophe is at issue here. I
guess that means I posted in the wrong group. Sorry.

In the meantime, I have broken out yea ole Apache reverse proxy trick
to make it look like the chat server and the web server are at the
same origin. Maybe I will try CORS again in 2012. With 30% of the
traffic being rendered by chrome, I will be accommodating chrome's
finickiness for quite some time.


On Sep 21, 3:19 pm, Jack Moffitt <j...@metajack.im> wrote:
> Those look correct to me. You might ask on the Tigase list if they
> have any ideas.  You could also double check your code by using my
> test bosh endpoint athttp://bosh.metajack.im:5280/xmpp-httpbind
Reply all
Reply to author
Forward
0 new messages