fix(hotdocs): SSR fetch 加 InvolutionHell-SSR UA 让 CF 放行#327
Merged
longsizhuo merged 1 commit intomainfrom Apr 27, 2026
Merged
Conversation
故障 首页右侧 "Hot This Week / 本周最热" 一直显示 "暂无数据"。 直接 curl 后端 /analytics/top-docs 是 200 + 5 条数据正常。 根因 其他 SSR fetcher(fetchProfile / events / feed)都带 "InvolutionHell-SSR/1.0 (+https://involutionhell.com)" UA,匹配 CF Custom Rule 跳过 Bot Fight。HotDocsPreview 之前没加 header,Vercel runner 默认 "node" UA 不匹配规则,按 IP 信誉被拦回 403/empty → catch 返 [] → "暂无数据"。 本 PR 跟其他 SSR fetcher 完全对齐,加 accept + user-agent header。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the homepage “Hot This Week / 本周最热” SSR data fetch being blocked by Cloudflare by adding the expected SSR User-Agent token so CF custom rules can allow the request through.
Changes:
- Add
User-Agent: InvolutionHell-SSR/1.0 (+https://involutionhell.com)to the Hot Docs SSR fetch request. - Add
Accept: application/jsonheader (consistent with other SSR fetchers) and document the Cloudflare rationale inline.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
故障
首页右上角 Hot This Week / 本周最热 一直 "暂无数据"。
(用户截图说"Top Rank 是空的"实际是看花眼了——左侧 Top Rank 早就有 TSK-Glofy 130 PTS / 0dysseus13 100 / duang3457 80 三张卡片,空的是右侧 Hot Docs 区块。)
根因
直接 `curl https://api.involutionhell.com/analytics/top-docs?window=7d&limit=5\` 200 + 5 条数据正常。
`HotDocsPreview.tsx` 的 SSR fetch 没带 UA header,Vercel runner 默认 `node` UA 不匹配你 CF 的 Custom Rule(`UA contains "InvolutionHell-SSR" → Skip Bot Fight`),按 IP 信誉被拦下回 403/empty → catch 返 `[]` → "暂无数据"。
代码库其他 SSR fetcher 都已经带 `InvolutionHell-SSR/1.0` UA:
唯独 HotDocsPreview 漏了。本 PR 补齐。
Test plan