Adds https support; Fixes prod config

This commit is contained in:
pikiou
2021-11-23 22:55:03 +01:00
parent 02be480cca
commit 3ac9c72a8b
8 changed files with 134 additions and 45 deletions

15
src/routes/certbot.ts Normal file
View File

@@ -0,0 +1,15 @@
/* Copyright Coplay. All Rights Reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file at https://coplay.org/colicense */
import { NextFunction, Request, Response, Router } from "express"
import * as path from "path"
const certbotRouter: Router = Router()
certbotRouter.use((request: Request, response: Response, _next: NextFunction) => {
const filename = request.originalUrl.replace(/.*\//, "")
const resolvedPath: string = path.resolve(`../certbot/.well-known/acme-challenge/${filename}`)
console.log("response", resolvedPath)
response.setHeader("Content-Type", "text/html")
return response.sendFile(resolvedPath)
})
export default certbotRouter