⚡️ Describe the Bug
api/main.py has no CORS middleware configured. Any request made from a browser-based frontend (React, vanilla JS, etc.) running on a different origin gets blocked with a CORS policy error. The API works fine from curl or Postman, but not from any browser.
👣 Steps to Reproduce
- Start the API with
uvicorn api.main:app --reload (runs on port 8000)
- Open a frontend app on a different port (e.g.
http://localhost:3000)
- Try calling any endpoint like
POST /forms/fill via fetch() or axios
- Browser console shows:
Access to fetch has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present
📉 Expected Behavior
The API should include CORS middleware so that frontend apps running on different origins can communicate with it without being blocked by the browser.
🖥️ Environment Information
- OS: macOS
- Docker/Compose Version: Docker 27.x / Compose v2
- Ollama Model used: N/A (this is an API-level config issue)
📸 Screenshots/Logs
Current api/main.py — no CORS setup at all:
from fastapi import FastAPI
from api.routes import templates, forms
app = FastAPI()
app.include_router(templates.router)
app.include_router(forms.router)
⚡️ Describe the Bug
api/main.py has no CORS middleware configured. Any request made from a browser-based frontend (React, vanilla JS, etc.) running on a different origin gets blocked with a CORS policy error. The API works fine from curl or Postman, but not from any browser.
👣 Steps to Reproduce
uvicorn api.main:app --reload(runs on port 8000)http://localhost:3000)POST /forms/fillviafetch()oraxiosAccess to fetch has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present📉 Expected Behavior
The API should include CORS middleware so that frontend apps running on different origins can communicate with it without being blocked by the browser.
🖥️ Environment Information
📸 Screenshots/Logs
Current api/main.py — no CORS setup at all: