
Why Google Wasn't Indexing My FastAPI Site — The HEAD Request Trap
The Symptom: 93 Pages Invisible to Google I run a technical blog on FastAPI behind Cloudflare Tunnel. Google Search Console showed: Server error (5xx) : 1 page Discovered — currently not indexed : 93 pages The site worked perfectly in a browser. Every page returned 200. Sitemap was valid. robots.txt allowed everything. So what was wrong? The Clue: HEAD Returns 405 curl -s -o /dev/null -w "%{http_code}" https://media.patentllm.org/ # 200 ✓ curl -s -o /dev/null -w "%{http_code}" -X HEAD https://media.patentllm.org/ # 405 ✗ Every page rejected HEAD requests with 405 Method Not Allowed . Googlebot uses HEAD requests during crawling to check pages before fetching full content. When HEAD returns 405, Google logs it as a server error and the page gets stuck in "Discovered — currently not indexed" limbo. Root Cause: FastAPI + Starlette Version FastAPI 0.133.1 with Starlette 0.52.1 does not automatically handle HEAD requests on GET routes. from fastapi import FastAPI from fastapi.testclient imp
Continue reading on Dev.to Webdev
Opens in a new tab




