Return to Snippet

Revision: 58322
at July 7, 2012 10:32 by chrisaiv


Initial Code
app.get( "/crossdomain.xml", onCrossDomainHandler )
function onCrossDomainHandler( req, res ) {
  var xml = '<?xml version="1.0"?>\n<!DOCTYPE cross-domain-policy SYSTEM' + 
            ' "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">\n<cross-domain-policy>\n';
      xml += '<allow-access-from domain="*" to-ports="*"/>\n';
      xml += '</cross-domain-policy>\n';
  
  req.setEncoding('utf8');
  res.writeHead( 200, {'Content-Type': 'text/xml'} );
  res.end( xml );  
}

Initial URL

                                

Initial Description
There are many ways to deliver a crossdomain.xml file through NodeJS or Express.js.  Here is one solution

Initial Title
NodeJS: Delivering a crossdomain.xml file using Express.JS

Initial Tags
js

Initial Language
JavaScript