A very simple and unsafe :-), self-signed, CORS https node.js dev stub service in TypeScript


const https = require("https"); const fs = require("fs"); // To create the key.pem and cert.pem files for dev, use opensll: // openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem // // Cert and key are created for hosheader "stub.service.am.dev". // Make sure the hosts file on windows contains: // 127.0.0.1 stub.service.am.dev const options = { key: fs.readFileSync("./key.pem"), cert: fs.readFileSync("./cert.pem") }; const port = 4433; https.createServer(options, function (req: any, res: any) { // Allow calls from all domains, for all methods ans request headers. res.setHeader("Access-Control-Allow-Origin", "*"); res.setHeader("Access-Control-Allow-Credentials", true); res.setHeader("Access-Control-Allow-Methods", "*"); res.setHeader("Access-Control-Allow-Headers", "*"); res.end(`Request received on server. Path Hit: ${res.url}`); }).listen(port, function() { console.log(`Stub service listing on ${port}`); });


Just enter https://stub.service.am.dev:4433 and it should respond with:

Request received on server. Path Hit: undefined

Fix in IE – Angular 1.6.1 Disabling automatic bootstrap. <script> protocol indicates an extension, document.location.href does not match.

When using angular 1.6.1 in IE9, IE10, IE11, I was getting the error:


Disabling automatic bootstrap. <script> protocol indicates an extension,

document.location.href does not match.


This seemed to be an 1.5.x issue, that was fixed in 1.5.11, but I was getting the error in 1.6.1.

To fix the error I switched from automatic bootstrapping (ng-app) to manual bootstrapping.

So I changed: <html xmlns:ng="http://angularjs.org" id="ng-app" ng-app=ā€¯myapp">

to: <html>

And after my module declaration:

angular.module('myapp', []);

angular.element(document).ready(function () {
angular.bootstrap(document, ['myapp']);
});