From 72529d0916d47da6a30909a0d500edfe3a57b10f Mon Sep 17 00:00:00 2001 From: martbost Date: Fri, 28 Aug 2026 14:17:15 -0500 Subject: [PATCH] Answer HEAD on /tv/ videos The route matched GET only, so a HEAD probe fell through to the JSON handler and 404'd. Some players issue HEAD before streaming; they would have concluded the file did not exist. Co-Authored-By: Claude Fable 5 --- server.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 92356fb..bf891c2 100644 --- a/server.js +++ b/server.js @@ -1068,7 +1068,7 @@ async function handleApi(req,res,pathname){ // // Range support is not optional here: without it the browser cannot seek, so // the scrub bar looks present but does nothing. - if(req.method==='GET'&&/^\/tv\/[a-z0-9-]{1,60}\.mp4$/.test(pathname)){ + if((req.method==='GET'||req.method==='HEAD')&&/^\/tv\/[a-z0-9-]{1,60}\.mp4$/.test(pathname)){ const slug=pathname.slice(4).replace(/\.mp4$/,''); const vfile=path.join(DATA_DIR,'tool-videos',slug+'.mp4'); let st=null; @@ -1088,6 +1088,7 @@ async function handleApi(req,res,pathname){ return fs.createReadStream(vfile,{start,end}).pipe(res); } res.writeHead(200,securityHeaders(Object.assign({},base,{'Content-Length':st.size}))); + if(req.method==='HEAD')return res.end(); return fs.createReadStream(vfile).pipe(res); }