Setting up greenlock-express

I’m trying to implement greenlock-express in my app. Here is what I did.

 var lex = require('greenlock-express').create({
  server: 'staging',
  challengeType: 'http-01',
  challenges: { 'tls-sni-01': require('le-challenge-fs').create({ webrootPath: '/tmp/acme-challenges' }) },
  store: require('le-store-certbot').create({ webrootPath: '/tmp/acme-challenges' }),
  approveDomains: approveDomains
});

var approveDomains = function(opts, certs, cb) {

  if (certs) { 
    opts.domains = certs.altnames; 
  } else {
    opts.domains = ['www.domain.com', 'domain.com']; 
    opts.emails = 'email@domain.com';
    opts.agreeTos = true;  
  }

  cb(null, { options: opts, certs: certs });
} 

require('http').createServer(lex.middleware(require('redirect-https')())).listen(8080, function () {
  console.log("Listening for ACME http-01 challenges on", this.address());
});

// express app settings, router, etc...

require('https').createServer(lex.httpsOptions, lex.middleware(app)).listen(443, function () {
  console.log("Listening for ACME tls-sni-01 challenges and serve app on", this.address());
});

So I followed all the steps in the documentation and there are no errors being returned. So I’m doing it right.

The problem happens when I try to access localhost:8080 it redirects me to https://localhost but the page is blank. I don’t know why.

I checked if the port is blocked with nestat -an and both of their state are set to listening.

Not too sure what is going on.

Thank you,
Mark

hi @marco3211

This seems to be more a question about nodeJS so probably better put to a nodeJS and Express forum.

If it’s a greenlock-express issues then feel free to submit an issue on the authors git

Andrei

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.