CORS Errors with LocalHost
I've been testing an application and up until yesterday everything was working fine. Now, I'm getting CORS errors on localhost. I didn't think this was possible as its still the same domain.
For context, i'm runnning a next.js frontend which is calling a FASTAPI backend. For testing, my FASTAPI CORS config looks like this:
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=[
# "https://mergersai.io",
# "https://www.mergersai.io",
"*",
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
expose_headers=["*"],
)
Error: Access to XMLHttpRequest at 'http://localhost:8000/start_scraping' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Has ayone got any ideas? I'm at a loss at how to troubleshoot.2 Replies