Skip to content

robots.txt 가 모든 명시 봇에게 /api 를 열어두던 문제 + cron 9시간 오차 - #2

Open
mikim wants to merge 1 commit into
mainfrom
claude/fix-robots-and-cron-tz
Open

robots.txt 가 모든 명시 봇에게 /api 를 열어두던 문제 + cron 9시간 오차#2
mikim wants to merge 1 commit into
mainfrom
claude/fix-robots-and-cron-tz

Conversation

@mikim

@mikim mikim commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

media.moss.land 서버 점검 중 같은 박스에서 도는 alpha 를 확인하다 발견했습니다.

1. robots.txt — 명시한 봇 전부가 /api/ 를 크롤할 수 있습니다

app/robots.ts 가 이름을 지정한 봇마다 { userAgent: "X", allow: "/" } 만 두고 있었습니다. 그런데 robots.txt 의 그룹 매칭은 배타적입니다 — 크롤러는 자기를 지목한 가장 구체적인 그룹 하나만 읽고 나머지는 통째로 무시합니다.

따라서 Googlebot·bingbot·Yeti 와 AI 크롤러 6종은 * 그룹의 Disallow전혀 상속하지 않습니다. 지금 실제로 이렇게 서빙 중입니다:

$ curl -s https://alpha.moss.land/robots.txt
User-Agent: *
Allow: /
Disallow: /api/
Disallow: /admin/
Disallow: /_next/

User-Agent: Googlebot
Allow: /            ← Disallow 없음. /api/ 크롤 가능

명시 그룹들이 동일한 disallow 목록을 갖도록 수정했습니다.

추가: host: SITE.baseUrlHost: https://alpha.moss.land 를 내보내고 있었습니다. Host 디렉티브는 스킴 없는 순수 호스트명이라 이대로는 무효이고 크롤러가 그냥 버립니다.

2. cron 이 9시간 어긋나 있습니다

헤더가 호스트를 "production Mac mini, KST" 로 기술했는데 둘 다 틀렸습니다.

  • alpha-web 은 Tailscale 노드 atrn-vm-linux 에서 돕니다
  • timedatectlEtc/UTC

2026-05-07 커밋이 이 가정 위에서 모든 스케줄을 KST 벽시계로 다시 썼고, 결과적으로 잡을 반대 방향으로 9시간 옮겼습니다. "매일 08:30 KST" 라고 적힌 daily brief 는 실제로 17:30 KST 에 돕니다.

12개 스케줄을 전부 UTC 로 변환하고 의도한 KST 시각을 인라인 주석으로 달았습니다. 헤더는 호스트 시간대를 확인된 사실 로 명시했습니다.

alpha-brief-cron       30 23 * * *   // UTC = 08:30 KST 익일
alpha-persona-cron      0  0 * * *   // UTC = 09:00 KST
alpha-audit-cron        0  2 * * 1   // UTC = 11:00 KST
...

⚠️ 별건 — cron 12개가 pm2 에 아예 등록돼 있지 않습니다

이 PR 로 고쳐지지 않는 문제입니다. 서버 확인 결과:

ecosystem.config.cjs 정의: 13개
pm2 등록:                  1개 (alpha-web)

daily brief, macro fetch, synthesis, persona tick/reply, IndexNow, 번역, calls 추적, connections, audit — 전부 돌지 않고 있습니다. 등록은 유료 API(Grok/OpenAI) 호출과 페르소나 콘텐츠 발행을 시작시키므로 제가 임의로 켜지 않았습니다. 판단 후 알려주시면 처리하겠습니다.

검증 한계

tsc 와 Next 컴파일은 통과했지만, alpha 의 전체 빌드는 이 머신에 없는 better-sqlite3 네이티브 바인딩을 요구해 prerender 단계에서 멈춥니다. robots 출력 형태 자체는 동일한 패턴이 media.moss.land 프로덕션에서 이미 정상 동작하는 것으로 확인했습니다.

🤖 Generated with Claude Code

robots.txt
  Every named bot had a bare `{ userAgent: "X", allow: "/" }` group.
  robots.txt group matching is exclusive — a crawler obeys only the most
  specific group naming it — so Googlebot, bingbot, Yeti and all six AI
  crawlers inherited nothing from the `*` group and were being handed
  /api/, /admin/ and /_next/. That is what alpha.moss.land serves today:

      User-Agent: Googlebot
      Allow: /

  Named groups now repeat the same disallow list.

  Also `host: SITE.baseUrl` emitted "Host: https://alpha.moss.land". The
  Host directive takes a bare hostname; with a scheme it is invalid and
  crawlers drop the line.

cron timezone
  The header claimed the box was "the production Mac mini" on KST. It is
  neither — alpha-web runs on the Tailscale node atrn-vm-linux, and
  `timedatectl` reports Etc/UTC. The 2026-05-07 change rewrote every
  schedule into KST wall-clock against that assumption, moving the jobs 9
  hours the wrong way: the "08:30 KST" daily brief fires at 17:30 KST.

  All 12 schedules converted to UTC with the intended KST time annotated
  inline, and the header now states the host timezone as verified.

Compiles and typechecks; alpha's full build needs a better-sqlite3 native
binding this machine lacks. The robots output shape is the same one
running in production on media.moss.land.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant