Browse Source

use letsencrypt naming convention, and more recent localhost.daplie.com

master
AJ ONeal 8 years ago
parent
commit
305692ce9e
  1. 9
      README.md
  2. 29
      serve.js

9
README.md

@ -85,13 +85,16 @@ node ./request-without-warnings.js 8043
Test (warning free) with cURL
```bash
curl -v https://localhost.daplie.com \
--cacert client/chain.pem
curl -v https://localhost.daplie.com:8043 \
--cacert certs/client/chain.pem
```
Note: on macOS curl's `--cacert` option may not work properly
and so you may need to add the cert to the system keychain (described below)
Visit in a web browser
<https://localhost.daplie.com>
<https://localhost.daplie.com:8043>
To get rid of the warnings, simply add the certificate in the `client` folder
to your list of certificates by alt-clicking "Open With => Keychain Access"

29
serve.js

@ -1,26 +1,15 @@
#!/usr/bin/env node
'use strict';
var https = require('https')
, port = process.argv[2] || 8043
, fs = require('fs')
, path = require('path')
, server
, options
;
require('ssl-root-cas')
.inject()
.addFile(path.join(__dirname, 'certs', 'server', 'my-root-ca.crt.pem'))
;
options = {
key: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'privkey.pem'))
// You don't need to specify `ca`, it's done by `ssl-root-cas`
//, ca: [ fs.readFileSync(path.join(__dirname, 'certs', 'server', 'my-root-ca.crt.pem'))]
, cert: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'fullchain.pem'))
};
var https = require('https');
var port = process.argv[2] || 8043;
var fs = require('fs');
var path = require('path');
var server;
var options = {
key: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'privkey.pem'))
, cert: fs.readFileSync(path.join(__dirname, 'certs', 'server', 'fullchain.pem'))
};
function app(req, res) {
res.setHeader('Content-Type', 'text/plain');

Loading…
Cancel
Save