Improves logging.
This commit is contained in:
parent
010728cb59
commit
584fa75842
1 changed files with 4 additions and 0 deletions
|
|
@ -69,6 +69,7 @@ const listener = async function (req, res) {
|
||||||
if (!host) {
|
if (!host) {
|
||||||
res.writeHead(400);
|
res.writeHead(400);
|
||||||
res.write('Host header is required');
|
res.write('Host header is required');
|
||||||
|
console.log('⏹ HTTP/2 400 - Host header is required');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let cache = resolveCache[host];
|
let cache = resolveCache[host];
|
||||||
|
|
@ -80,15 +81,18 @@ const listener = async function (req, res) {
|
||||||
res.writeHead(302, {
|
res.writeHead(302, {
|
||||||
'Location': (process.env.BLACKLIST_REDIRECT || 'https://www.youtube.com/watch?v=dQw4w9WgXcQ') /*+ "?d=" + req.headers.host*/,
|
'Location': (process.env.BLACKLIST_REDIRECT || 'https://www.youtube.com/watch?v=dQw4w9WgXcQ') /*+ "?d=" + req.headers.host*/,
|
||||||
});
|
});
|
||||||
|
console.log('⏸ HTTP/2 302 - Blacklist: ' + req.headers.host );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
res.writeHead(cache.httpStatus, {
|
res.writeHead(cache.httpStatus, {
|
||||||
'Location': cache.expand ? combineURLs(cache.url, url) : cache.url,
|
'Location': cache.expand ? combineURLs(cache.url, url) : cache.url,
|
||||||
});
|
});
|
||||||
|
console.log('⏵ HTTP/2 ' + cache.httpStatus + ' OK: ' + req.headers.host );
|
||||||
return;
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.writeHead(400);
|
res.writeHead(400);
|
||||||
res.write(error.message || 'Unknown error');
|
res.write(error.message || 'Unknown error');
|
||||||
|
console.log('⏹ HTTP/2 400 - ' + (error.message || 'Unknown error'));
|
||||||
} finally {
|
} finally {
|
||||||
res.end();
|
res.end();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue