Whoa! Thanks for the helpful lvh.me idea Forrest! I'm now going to setup 'localhost.*.com' on every domain I own to facilitate HTTPS testing :D
On Monday, May 20, 2013 8:22:48 AM UTC-7, Forrest L Norvell wrote: > > Hey James, > > 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. > > F > > On Monday, May 20, 2013, James Coglan wrote: > >> Hi there, >> >> I have various test suites that use self-signed certs to test HTTPS/TLS >> stuff. I'm trying to use the 'ca' option of the tls and https clients to >> make them trust my certs, rather than forgoing validation at all, since I >> would rather give my projects APIs for adding CAs than for disabling >> validation. >> >> However when I pass my server certificate in the 'ca' option of an HTTPS >> request I get this error: >> >> "Error: Hostname/IP doesn't match certificate's altnames" >> >> I followed these steps to generate the certificate: >> http://www.akadia.com/services/ssh_test_certificate.html >> >> What does this error mean and how do I fix it? >> >> Here are some example scripts that demo the problem: >> >> >> // 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: 'localhost', >> 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); >> }); >> >> >> -- >> James Coglan >> http://jcoglan.com >> +44 (0) 7771512510 >> >> -- >> -- >> 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 nodejs@googlegroups.com >> To unsubscribe from this group, send email to >> nodejs+unsubscr...@googlegroups.com >> 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 nodejs+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > -- -- 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 nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com 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 nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.