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) {
|
||||
res.writeHead(400);
|
||||
res.write('Host header is required');
|
||||
console.log('⏹ HTTP/2 400 - Host header is required');
|
||||
return;
|
||||
}
|
||||
let cache = resolveCache[host];
|
||||
|
|
@ -80,15 +81,18 @@ const listener = async function (req, res) {
|
|||
res.writeHead(302, {
|
||||
'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;
|
||||
}
|
||||
res.writeHead(cache.httpStatus, {
|
||||
'Location': cache.expand ? combineURLs(cache.url, url) : cache.url,
|
||||
});
|
||||
console.log('⏵ HTTP/2 ' + cache.httpStatus + ' OK: ' + req.headers.host );
|
||||
return;
|
||||
} catch (error) {
|
||||
res.writeHead(400);
|
||||
res.write(error.message || 'Unknown error');
|
||||
console.log('⏹ HTTP/2 400 - ' + (error.message || 'Unknown error'));
|
||||
} finally {
|
||||
res.end();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue