Fix join path
This commit is contained in:
parent
fca036f7e3
commit
a5e3f99ecf
3 changed files with 4 additions and 7 deletions
|
|
@ -1,5 +1,4 @@
|
|||
const fs = require('fs')
|
||||
const http = require('http')
|
||||
const path = require('path')
|
||||
const {
|
||||
promisify
|
||||
|
|
@ -105,16 +104,12 @@ class Client {
|
|||
challenge
|
||||
} = await this.authz(authzUrls[0])
|
||||
|
||||
console.log('step 1');
|
||||
await this.completeChallenge(challenge)
|
||||
console.log('step 2');
|
||||
await this.pollAuthz(authzUrls[0])
|
||||
console.log('step 3');
|
||||
const {
|
||||
certificate,
|
||||
privateKeyData
|
||||
} = await this.finalizeOrder(finalizeUrl, domain, email)
|
||||
console.log('step 4');
|
||||
|
||||
return {
|
||||
certificate,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ const {
|
|||
const {
|
||||
findTxtRecord
|
||||
} = require('./util');
|
||||
const combineURLs = require('axios/lib/helpers/combineURLs');
|
||||
|
||||
/**
|
||||
* @type {Object<string, {expire: number, expand: boolean, url: string}>}
|
||||
|
|
@ -36,6 +37,7 @@ const listener = async function (/** @type {import('http').IncomingMessage} */ r
|
|||
if (req.url.startsWith(acme_prefix)) {
|
||||
if (client.challengeCallbacks) {
|
||||
res.writeHead(200, {
|
||||
// This is important :)
|
||||
'content-type': 'application/octet-stream'
|
||||
});
|
||||
res.write(client.challengeCallbacks());
|
||||
|
|
@ -51,7 +53,7 @@ const listener = async function (/** @type {import('http').IncomingMessage} */ r
|
|||
resolveCache[req.headers.host] = cache;
|
||||
}
|
||||
res.writeHead(301, {
|
||||
'Location': cache.expand ? path.join(cache.url, req.url) : cache.url,
|
||||
'Location': cache.expand ? combineURLs(cache.url, req.url) : cache.url,
|
||||
});
|
||||
return;
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const {
|
|||
const { default: AwaitLock } = require('await-lock');
|
||||
const record_email_prefix = 'forward-domain-cert-maintainer=';
|
||||
const client = new certnode.Client();
|
||||
const certsDir = path.join(__dirname, '.certs');
|
||||
const certsDir = path.join(__dirname, '../.certs');
|
||||
|
||||
/**
|
||||
* @type {Object<string, {cert: any, key: any, expire: number}>}
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue