Page MenuHomePhabricator

Aphlict Client does not work when the SWF is served from an alternative domain
Closed, ResolvedPublic

Description

So for some reason the Flash applet on https://code.redpointsoftware.com.au/ is not connecting to the notification server.

I can verify the notification server is running correctly by visiting http://code.redpointsoftware.com.au:22280/ and seeing the following in the log:

bin/aphlict debug
Starting Aphlict server in foreground...
Launching server:

    $ 'node' '/srv/phabricator/phabricator/src/applications/aphlict/management/../../../../support/aphlict/server/aphlict_server.js' --port='22280' --admin='22281' --host='localhost' --user='git'

[Fri Jun 13 2014 07:12:47 GMT+0000 (UTC)] Started Server (PID 17430)
[Fri Jun 13 2014 07:13:01 GMT+0000 (UTC)] notification: {"type":"message","threadPHID":"PHID-CONP-pw6s6d52extnn2zyrbeu","messageID":33,"subscribers":["PHID-CONP-pw6s6d52extnn2zyrbeu"]}
[Fri Jun 13 2014 07:13:32 GMT+0000 (UTC)] notification: {"type":"message","threadPHID":"PHID-CONP-pw6s6d52extnn2zyrbeu","messageID":34,"subscribers":["PHID-CONP-pw6s6d52extnn2zyrbeu"]}
[Fri Jun 13 2014 07:14:02 GMT+0000 (UTC)] notification: {"type":"message","threadPHID":"PHID-CONP-pw6s6d52extnn2zyrbeu","messageID":35,"subscribers":["PHID-CONP-pw6s6d52extnn2zyrbeu"]}
[Fri Jun 13 2014 07:14:23 GMT+0000 (UTC)] notification: {"type":"message","threadPHID":"PHID-CONP-pw6s6d52extnn2zyrbeu","messageID":36,"subscribers":["PHID-CONP-pw6s6d52extnn2zyrbeu"]}
[Fri Jun 13 2014 07:14:43 GMT+0000 (UTC)] notification: {"type":"message","threadPHID":"PHID-CONP-pw6s6d52extnn2zyrbeu","messageID":37,"subscribers":["PHID-CONP-pw6s6d52extnn2zyrbeu"]}
[Fri Jun 13 2014 07:14:47 GMT+0000 (UTC)] notification: {"type":"message","threadPHID":"PHID-CONP-pw6s6d52extnn2zyrbeu","messageID":38,"subscribers":["PHID-CONP-pw6s6d52extnn2zyrbeu"]}
[Fri Jun 13 2014 07:14:50 GMT+0000 (UTC)] notification: {"type":"message","threadPHID":"PHID-CONP-pw6s6d52extnn2zyrbeu","messageID":39,"subscribers":["PHID-CONP-pw6s6d52extnn2zyrbeu"]}
[Fri Jun 13 2014 07:14:51 GMT+0000 (UTC)] notification: {"type":"message","threadPHID":"PHID-CONP-pw6s6d52extnn2zyrbeu","messageID":40,"subscribers":["PHID-CONP-pw6s6d52extnn2zyrbeu"]}
[Fri Jun 13 2014 07:14:52 GMT+0000 (UTC)] notification: {"type":"message","threadPHID":"PHID-CONP-pw6s6d52extnn2zyrbeu","messageID":41,"subscribers":["PHID-CONP-pw6s6d52extnn2zyrbeu"]}
[Fri Jun 13 2014 07:17:16 GMT+0000 (UTC)] notification: {"key":"6024309406535468731","type":"notification","subscribers":["PHID-USER-4bruxoj4jpjrmz6invrc"]}
[Fri Jun 13 2014 07:17:33 GMT+0000 (UTC)] <Listener/1> Connected from 172.17.42.1
[Fri Jun 13 2014 07:17:33 GMT+0000 (UTC)] <Listener/2> Connected from 172.17.42.1
[Fri Jun 13 2014 07:17:44 GMT+0000 (UTC)] <Listener/2> Ended Connection
[Fri Jun 13 2014 07:17:44 GMT+0000 (UTC)] <Listener/2> Disconnected
[Fri Jun 13 2014 07:17:51 GMT+0000 (UTC)] notification: {"key":"6024309554454390537","type":"notification","subscribers":["PHID-USER-4bruxoj4jpjrmz6invrc"]}
[Fri Jun 13 2014 07:17:55 GMT+0000 (UTC)] notification: {"key":"6024309575104291512","type":"notification","subscribers":["PHID-USER-4bruxoj4jpjrmz6invrc"]}
[Fri Jun 13 2014 07:17:55 GMT+0000 (UTC)] notification: {"key":"6024309573277482244","type":"notification","subscribers":["PHID-USER-4bruxoj4jpjrmz6invrc"]}
[Fri Jun 13 2014 07:17:55 GMT+0000 (UTC)] notification: {"key":"6024309575013796671","type":"notification","subscribers":["PHID-USER-4bruxoj4jpjrmz6invrc"]}
[Fri Jun 13 2014 07:18:26 GMT+0000 (UTC)] <Listener/1> Ended Connection
[Fri Jun 13 2014 07:18:26 GMT+0000 (UTC)] <Listener/1> Disconnected

However there are no entries for any Flash applet connecting, and no notifications appear when browsing Phabricator.

Event Timeline

hach-que assigned this task to epriestley.
hach-que raised the priority of this task from to Needs Triage.
hach-que updated the task description. (Show Details)
hach-que added a project: Phabricator.
hach-que added subscribers: hach-que, joshuaspence.

The Aphlict client does seem to be connecting to the server (<Listener/1> Connected from 172.17.42.1), but not sending any subscriptions.

Are you able to turn on notification.debug and see what is happening client side?

notification.debug is already set to true.

And you don't get any debug output in the browser? (developer mode also needs to be enabled)

I turned on developer mode, I don't see any notifications or messages and there's nothing in the DarkConsole.

Looks like the server stopped for a moment, going to start it again and see what happens.

This might sound stupid, but for some reason it seems to work... Can you close all Phabricator tabs (on any domain) and re-open them and see if that fixes things? There can be versioning issues, particularly if one of your other tabs is the master.

(Started the server in debug mode again)

I closed Chrome completely and re-opened it on just https://code.redpointsoftware.com.au/notification/status/, there's no notifications at all.

(Notifications are working on secure.phabricator.com though)

If you wait long enough (~20 seconds) do you get an error popup?

The only thing I can think of is that Aphlict is being served from the file domain (https://rpcdn.com.au) and not the main domain (https://code.redpointsoftware.com.au). I don't know whether CORS is preventing Flash from even running the applet.

Yup, it's CORS alright.

I modified the HTML using the Chrome editor to change the domain to code.redpointsoftware.com.au, and I got a bunch of messages from Aphlict. The "Send Test Notification" button also works.

Oh. That could be an issue. To be honest, I hadn't tested that case. Are you able to (temporarily) serve Aphlict through the main domain and see if that helps?

OK. This is probably related to LocalConnection then.

Are you able to build Aphlict (it requires the flex-sdk)? I think that you might be able to fix this by modifying everywhere that a LocalConnection is created. Specifically, in support/aphlict/client/src/Aphlict.as:

this.recv = new LocalConnection();
this.recv.client = this;
this.recv.allowDomain('rpcdn.com.au');

this.send = new LocalConnection();
this.send.allowDomain('rpcdn.com.au');

That won't work; rpcdn.com.au points to a different IP address because of HTTPS (and the notification server ports are not bound to that IP). The correct fix is to serve Aphlict off the primary domain.

I think I have a fix in D9511, but I'm about to test it.

joshuaspence edited this Maniphest Task.
joshuaspence renamed this task from Browsers / Flash no longer connect to notification server to Aphlict Client does not work when the SWF is served from an alternative domain.Jun 13 2014, 5:37 PM
joshuaspence closed this task as Resolved.