Question: I'm unable to download a file stream from a web server using CasperJS:

* a form is posted to a url
* url returns a file stream

So far I have validated that the correct form values are posted.

```
var casper = require('casper').create({
    verbose: true, 
    logLevel: 'debug',
    viewportSize: {width: 1440, height: 800},
    pageSettings: {
        userName: '****',
        password: '****',
        webSecurityEnabled: false
    },
    waitTimeout: 200000
});

casper.start("***");

casper.then(function() {
    var exportForm = this.evaluate(function() {
        return $("#export_pdf_form").serialize();
    });

    var exportAction = this.evaluate(function() {
        return $("#export_pdf_form").attr('action');
    });

    var url, file;
    url = '***' + exportAction; (eg. https://webserver/export)
    file = "export.pdf";
    casper.page.settings.webSecurityEnabled = false;
    casper.download(url, fs.workingDirectory + '/' + file, "POST", exportForm);
});

```

Casper error "Unfortunately casperjs cannot make cross domain ajax requests" followed by "XMLHttpRequest Exception 101". After searching it states that settings the web security variable to false should make this work...but it doesn't. Anything else I should look into?

casperjs - v1.1.1
phantomjs - v2.0.0

Answer: 
Turns out nothing is wrong with my code, simply updating PhantomJS from 2.0.0 to 2.1.1 has solved the issue.
Alternative answer: You could implement a proxy, via an API interface through your site. Caveat: Best done only with resources that you control, as it requires your site to be responsible for the content, and could compromise your certificate if you allowed malware or insecure content.