I use jsreportonline. I recently changed my report rendering to both save reports and run them asynchronously. This was because the synchronous approach is blocking my express app:
client.render(
{
"template":{"shortid": myShortId},
"data": mydata,
"options": {"reports": {"save": true, "async": true }}
})
.then(function(response){
// Set status URL
res.json({"location": response.headers.location});
});
The goal was to return the location status URL to the client's browser so that the client could poll the status URL until the report had completed rendering and then download the report. Note my web client uses Angular 1.x
$http.get(response.location,{"responseType":'document'})
.then(
// Success
function(result){
// Check status of report....
// If complete, download report. Otherwise, poll again ....
});
In this example, response.location would read something like https://myapp.jsreportonline.net/reports/id/status
However, I ran into a problem when the client's browser attempted to check the status by getting the location URL. Because the browser does not have the credentials to my jsreportonline instance, the status check failed with the following error:
Mixed Content: The page at 'https://myapp.com/reportpage' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://jsreportonline.net/sign'. This request has been blocked; the content must be served over HTTPS.
So, what's the best way to have my client app poll the status of the save report and then download the final report? Should I be polling the status through my NodeJS app by using the jsreport-client package?