Naughty Platypus Memorabilia
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    crossdomainpublic

    crossdomain

    Render a crossdomain.xml so that Adobe Flash Player clients can make requests to your domain. More on this nonsense here.

    Installation

    $ npm install crossdomain
    

    Example

    var crossdomain = require('crossdomain');
     
    crossdomain({ domain: '*.segment.io' });

    which returns:

    <cross-domain-policy>
      <allow-http-request-headers-from domain="*.segment.io" headers="*"/>
      <site-control permitted-cross-domain-policies="all"/>
      <allow-access-from domain="*" secure="false"/>
    </cross-domain-policy>

    and Express integration works like this:

    var app = express();
    var xml = crossdomain({ domain: '*.segment.io' });
     
    app.all('/crossdomain.xml', function (req, res, next) {
      res.set('Content-Type', 'application/xml; charset=utf-8');
      res.send(xml, 200);
    });
     
    app.listen(8000);

    API

    .crossdomain(options)

    Generate a crossdomain.xml file with custom options. options.domain is mandatory, and everything else is defaulted to this:

    {
        "allow-http-request-headers-from-headers": "*",
        "site-control-permitted-cross-domain-policies": "all",
        "allow-access-from-domain": "*",
        "allow-access-from-secure": "false"
    }

    Read more about these options in the Adobe docs.

    License

    WWWWWW||WWWWWW
     W W W||W W W
          ||
        ( OO )__________
         /  |           \
        /o o|    MIT     \
        \___/||_||__||_|| *
             || ||  || ||
            _||_|| _||_||
           (__|__|(__|__|
    

    Keywords

    none

    install

    npm i crossdomain

    Downloadsweekly downloads

    95

    version

    0.0.1

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar