i need a static https server. I choosed node.js because of its portability. In this way i can just save a .js script in the repo and have the server easily runned on windows and linux machines.
After some research, i ended up with the following solution using connect:
var fs = require('fs');
var connect = require('connect');
var options = {
key: fs.readFileSync('ryans-key.pem'),
cert: fs.readFileSync('ryans-cert.pem')
};
connect(options, connect.logger() , connect.static(__dirname))
.listen(443);
Where the self signed certificates are generated using this guide. Unfortunaltely, this nice node script is not working properly. Indeed, i'm getting a 107 error on chrome, and a "The connection was interrupted" error with firefox.
What is missing to this setup in order to have the simple server working?
why i say node is portable: compared to other web servers like apache or nginx, i can keep a simple script in the repo root, instead of a configuration file somewhere in the filesystem. the position of such configuration file would change between different systems
why i need a secure level: because some of the contents rely on other contents that will not be allowed (asynchronously) if the origin domain is not secure
the certificate is needed, but you can always sign your own for development purposes and keep it in the repo together with the server script