tested working :-)

This commit is contained in:
AJ ONeal 2015-12-12 15:19:11 +00:00
parent 1e4affc079
commit 788cfaebe1
2 changed files with 5 additions and 19 deletions

View File

@ -24,24 +24,19 @@ var bkDefaults = {
webroot: true
, webrootPath: path.join(__dirname, '..', 'tests', 'acme-challenge')
, fullchainTpl: '/live/:hostname/fullchain.pem'
, privkeyTpl: '/live/:hostname/fullchain.pem'
, privkeyTpl: '/live/:hostname/privkey.pem'
, configDir: path.join(__dirname, '..', 'tests', 'letsencrypt.config')
, logsDir: path.join(__dirname, '..', 'tests', 'letsencrypt.logs')
, workDir: path.join(__dirname, '..', 'tests', 'letsencrypt.work')
, server: LEP.stagingServer
, text: true
};
var le = require('../').create(lep, bkDefaults, {
});
var le = require('../').create(lep, bkDefaults, { });
var localCerts = require('localhost.daplie.com-certificates');
var express = require('express');
var app = express();
app.use('/', function (req, res, next) {
console.log('[DEBUG]', req.method, req.protocol, req.hostname, req.url);
next();
});
app.use('/', le.middleware());
var server = require('http').createServer();

View File

@ -77,8 +77,8 @@ module.exports.create = function (letsencrypt, defaults, options) {
return PromiseA.resolve();
}
, middleware: function () {
console.log('[DEBUG] webrootPath', defaults.webrootPath);
var serveStatic = require('serve-static')(defaults.webrootPath);
//console.log('[DEBUG] webrootPath', defaults.webrootPath);
var serveStatic = require('serve-static')(defaults.webrootPath, { dotfiles: 'allow' });
var prefix = '/.well-known/acme-challenge/';
return function (req, res, next) {
@ -87,16 +87,7 @@ module.exports.create = function (letsencrypt, defaults, options) {
return;
}
console.log('[DEBUG] req.url 0', req.url);
var pathname = req.url;
req.url = req.url.substr(prefix.length - 1);
console.log('[DEBUG] req.url 1', req.url);
serveStatic(req, res, function (err) {
console.log('[DEBUG] req.url 2', req.url);
req.url = pathname;
console.log('[DEBUG] req.url 3', req.url);
next(err);
});
serveStatic(req, res, next);
};
}
, SNICallback: sniCallback