On 20 May 2013 18:00, Forrest L Norvell <[email protected]> wrote:
> On Monday, May 20, 2013, James Coglan wrote: > >> On 20 May 2013 16:22, Forrest L Norvell <[email protected]> wrote: >> >>> I've never gotten cert stuff to work properly with localhost as the host >>> name. Try generating your certificate for lvh.me (*.lvh.me resolve to >>> 127.0.0.1 -- super handy) and requesting from same, and that should fix it. >>> >> >> Do you know how to specify the hostname when generating the certs? >> > > Two ways: > > 1. If you're using the default, interactive process to generate the cert, > provide whatever.lvh.me when prompted for the certificate's "common name." > 2. if you're passing a complete X.509 subject to the OpenSSL command > (--subj), make sure .../CN=whatever.lvh.me is in the subject. > > See https://github.com/newrelic/node-newrelic/blob/master/Makefile for > an example of generating a CA / cert pair from scratch unattended. > I've now generated a self-signed cert for lvh.me and the client has stopped emitting errors. However, it doesn't emit a response either, the script just hangs. What's going on? // server.js var https = require('https'), fs = require('fs'); var server = https.createServer({ cert: fs.readFileSync('./server.crt'), key: fs.readFileSync('./server.key') }); server.on('request', function(request, response) { response.writeHead(200, {'Content-Type': 'text/plain'}); response.end('Hello\n'); }); server.listen(8000); // client.js var https = require('https'), fs = require('fs'); var request = https.request({ method: 'GET', host: 'lvh.me', port: 8000, path: '/', ca: [fs.readFileSync('./server.crt')] }); request.on('error', function(error) { console.log('ERROR', error); }); request.on('response', function(response) { console.log(response.statusCode); }); -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
