cd /news/developer-tools/a-cors-mismatch-that-broke-docmind-a… Β· home β€Ί topics β€Ί developer-tools β€Ί article
[ARTICLE Β· art-69956] src=dev.to β†— pub= topic=developer-tools verified=true sentiment=Β· neutral

A CORS Mismatch That Broke DocMind AI on a Fresh Netlify Deploy

A developer fixed a CORS mismatch that broke DocMind AI, a RAG-based document chatbot, after a Netlify redeploy. The backend's allow_origins list still contained the old domain without a hyphen, blocking requests from the new deployment. The fix added the missing domain to the allowlist.

read2 min views1 publishedJul 23, 2026

This is a submission for DEV's Summer Bug Smash: Clear the Lineup powered by Sentry.

DocMind AI is a RAG-based document chatbot β€” you upload documents and ask questions about them, and it retrieves relevant context and generates grounded answers. The stack: FastAPI backend, Groq LLaMA 3.3 for generation, Pinecone for vector storage, HuggingFace embeddings, and a Netlify-hosted frontend, with voice input/output built on top.

The backend already had CORS configured correctly in principle β€” CORSMiddleware

was in place, scoped to a specific origin rather than a wildcard, with allow_credentials=False

and an explicit method/header allowlist. That part was never the problem.

The actual bug was a domain mismatch. The frontend had been redeployed to a new Netlify site, docmindai-chatbot.netlify.app

β€” note the hyphen β€” while the backend's allow_origins

list still only contained the old domain, docmindaichatbot.netlify.app

, without the hyphen. Two names that look almost identical at a glance, but the browser treats them as completely different origins. Every request from the new deployment was blocked before it reached the API, while the old domain kept working fine β€” which made it easy to miss at first, since "the app works" and "the app works from the URL I'm actually testing" turned out to be different claims.

Commit: 291e6d8 β€” Update CORS to allow new Netlify domain

Before:

allow_origins=["https://docmindaichatbot.netlify.app"],

After:

allow_origins=["https://docmindai-chatbot.netlify.app", "https://docmindaichatbot.netlify.app"],

Full block, unchanged parts included for context:

app.add_middleware(
    CORSMiddleware,
    allow_origins=["https://docmindai-chatbot.netlify.app", "https://docmindaichatbot.netlify.app"],
    allow_credentials=False,
    allow_methods=["GET", "POST", "OPTIONS"],
    allow_headers=["Content-Type", "Accept"],
)

Repo: uroojbuilds/Docmind-Ai

Live demo: docmindai-chatbot.netlify.app

The fix itself is a one-line addition, but the useful part was figuring out it was a CORS problem specifically, and not a broken deploy. The browser's network tab showed requests failing with no Access-Control-Allow-Origin

header, while the backend logs showed nothing at all for those requests β€” which is the classic CORS signature: the browser blocks the request before your server code ever runs, so there's nothing to catch in a try/except

or print statement. If the API were actually down, curling it directly would have failed too; instead, curl worked fine and only the browser call from the new Netlify URL failed, which pointed straight at an origin allowlist problem.

Rather than loosen the config to allow_origins=["*"]

β€” which would have made the symptom disappear immediately β€” I kept the existing narrow, explicit list and just added the missing domain. The backend already had allow_credentials=False

and a tight allow_methods

/allow_headers

list, which is good practice for a public API even without cookies in play, and a one-off deploy mismatch isn't a reason to give that up for convenience.

The lesson that's stuck with me: Netlify doesn't guarantee it'll reuse the exact site name you expect on every deploy, and a CORS allowlist has to track the actual deployed origin, not the one you assumed you'd get. Now when I redeploy the frontend, checking the live URL against allow_origins

is one of the first things I verify before calling it done.

── more in #developer-tools 4 stories Β· sorted by recency
── more on @docmind ai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/a-cors-mismatch-that…] indexed:0 read:2min 2026-07-23 Β· β€”