소스 검색

fix(server): respond to HEAD / so health checks return 200

curl -sSI and Traefik probes use HEAD; the server only handled GET,
causing HEAD / to fall through to the 404 handler.
fix/head-method
jochen 1 개월 전
부모
커밋
35c7c31f2e
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. +2
    -2
      server.mjs

+ 2
- 2
server.mjs 파일 보기

@@ -193,10 +193,10 @@ const server = createServer(async (req, res) => {
const { id, session } = getSession(req.headers["cookie"]);
const url = req.url.split("?")[0];

if (req.method === "GET" && url === "/") {
if ((req.method === "GET" || req.method === "HEAD") && url === "/") {
setCookie(res, id);
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
res.end(renderPage(session, "", null));
res.end(req.method === "HEAD" ? "" : renderPage(session, "", null));
return;
}



불러오는 중...
취소
저장