Bolt api

CORS Preflight Request Timeout - OPTIONS Request Failing

POST or other non-simple requests fail because the CORS preflight OPTIONS request times out. Browser doesn't even send the actual request.

Requests work in some browsers but not others, or fail intermittently.

Error Messages You Might See

OPTIONS request timeout Preflight request failed No 'Access-Control-Allow-Methods' header CORS preflight failed
OPTIONS request timeoutPreflight request failedNo 'Access-Control-Allow-Methods' headerCORS preflight failed

Common Causes

  1. Server doesn't handle OPTIONS method
  2. OPTIONS request takes too long to respond
  3. Firewall blocking OPTIONS method
  4. CORS headers missing in OPTIONS response
  5. Preflight cache too short, requesting too frequently

How to Fix It

Ensure server responds to OPTIONS: if(request.method === 'OPTIONS') return new Response(null, { status: 200, headers: corsHeaders })

Response must include CORS headers: 'Access-Control-Allow-Methods', 'Access-Control-Allow-Headers', 'Access-Control-Max-Age'

Set long max-age: 'Access-Control-Max-Age': '86400' (24 hours)

Use middleware to add CORS to all routes

Real developers can help you.

Prakash Prajapati Prakash Prajapati I’m a Senior Python Developer specializing in building secure, scalable, and highly available systems. I work primarily with Python, Django, FastAPI, Docker, PostgreSQL, and modern AI tooling such as PydanticAI, focusing on clean architecture, strong design principles, and reliable DevOps practices. I enjoy solving complex engineering problems and designing systems that are maintainable, resilient, and built to scale. Alvin Voo Alvin Voo I’ve watched the tech landscape evolve over the last decade—from the structured days of Java Server Pages to the current "wild west" of Agentic-driven development. While AI can "vibe" a frontend into existence, I specialize in the architecture that keeps it from collapsing. My expertise lies in the critical backend infrastructure: the parts that must be fast, secure, and scalable. I thrive on high-pressure environments, such as when I had only three weeks to architect and launch an Ethereum redemption system with minimal prior crypto knowledge, turning it into a major revenue stream. What I bring to your project: Forensic Debugging: I don't just "patch" bugs; I use tools like Datadog and Explain Analyzers to map out bottlenecks and resolve root causes—like significantly reducing memory usage by optimizing complex DB joins. Full-Stack Context: Deep experience in Node.js and React, ensuring backends play perfectly with mobile and web teams. Sanity in the Age of AI: I bridge the gap between "best practices" and modern speed, ensuring your project isn't just built fast, but built to last. Bastien Labelle Bastien Labelle Full stack dev w/ 20+ years of experience Dor Yaloz Dor Yaloz SW engineer with 6+ years of experience, I worked with React/Node/Python did projects with React+Capacitor.js for ios Supabase expert Daniel Vázquez Daniel Vázquez Software Engineer with over 10 years of experience on Startups, Government, big tech industry & consulting. Yovel Cohen Yovel Cohen I got a lot of experience in building Long-horizon AI Agents in production, Backend apps that scale to millions of users and frontend knowledge as well. Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. Rudra Bhikadiya Rudra Bhikadiya I build and fix web apps across Next.js, Node.js, and DBs. Comfortable jumping into messy code, broken APIs, and mysterious bugs. If your project works in theory but not in reality, I help close that gap. Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Luca Liberati Luca Liberati I work on monoliths and microservices, backends and frontends, manage K8s clusters and love to design apps architecture

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

What is preflight?

Browser sends OPTIONS request to check if server allows cross-origin request. Server responds with allowed methods/headers

How long should preflight cache?

Access-Control-Max-Age: 86400 (24 hours). Longer is better - fewer OPTIONS requests

Which requests need preflight?

Non-simple: PUT, DELETE, POST with custom headers. Simple: GET, HEAD, POST with form-data

Related Bolt Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help