powered by Jive Software

Support for custom client ports in cross-domain policy

There was a patch submitted a while ago for letting openfire serve a cross-domain policy:

http://www.igniterealtime.org/community/thread/32787

However, we have had problems with clients behind firewalls that doesn’t allow port 5222.

We solved this by using iptables to port forward from 443 to 5222, allowing users to

use that port as well.

Another problem arised, where the cross-domain policy only supports the ports that openfire

is actually listening on.

I’d like to suggest the following changes to be made so that one could specify additional ports

to the cross-domain policy:

org.jivesoftware.openfire.net.StanzaHandler:

String ports = String.valueOf(XMPPServer.getInstance().getConnectionManager().getClientListenerPort()); // Check if the cross domain ports should be overrided.
String alternativePorts = JiveGlobals.getProperty("flash.crossdomain.alternative.ports");if( org.apache.commons.lang.StringUtils.isNotBlank(alternativePorts) ){
     ports += "," + alternativePorts;
} String crossDomainText = FlashCrossDomainServlet.CROSS_DOMAIN_TEXT + ports + FlashCrossDomainServlet.CROSS_DOMAIN_END_TEXT + '\0';

org.jivesoftware.openfire.FlashCrossDomainHandler:

String ports = String.valueOf(XMPPServer.getInstance().getConnectionManager().getClientListenerPort()); // Check if the cross domain ports should be overrided. String alternativePorts = JiveGlobals.getProperty("flash.crossdomain.alternative.ports");if( StringUtils.isNotBlank(alternativePorts) ){
     ports += "," + alternativePorts;
} if (request.contains("<policy-file-request/>") || request.contains("GET /crossdomain.xml")) {
     out.write(CROSS_DOMAIN_TEXT + ports + CROSS_DOMAIN_END_TEXT+"\u0000");
}

org.jivesoftware.openfire.http.FlashCrossDomainServlet:

// Check if the cross domain ports should be overrided.
String alternativePorts = JiveGlobals.getProperty("flash.crossdomain.alternative.ports");
if( StringUtils.isNotBlank(alternativePorts) ) {
     builder.append(",");
     builder.append(alternativePorts);
}