This commit is contained in:
Yohan Daddou
2022-11-14 14:15:31 +01:00
parent 93dc3532cd
commit 7415cc9a2a
2 changed files with 2 additions and 14 deletions
+2 -1
View File
@@ -56,7 +56,7 @@ module.exports = function(opt) {
// root endpoint
app.use(async (ctx, next) => {
const path = ctx.request.path;
console.log("new request",path)
// skip anything not on the root path
if (path !== '/') {
await next();
@@ -119,6 +119,7 @@ module.exports = function(opt) {
server.on('request', (req, res) => {
// without a hostname, we won't know who the request is for
const hostname = req.headers.host;
console.log("new on request",req.path,req.headers.host);
if (!hostname) {
res.statusCode = 400;
res.end('Host header is required');