/Knowledge/sources/honojs__hono/llms-full/cors-middleware-using-with-vite--eaac34028768.md
CORS Middleware: Using with Vite - hono-docs
CORS Middleware: Using with Vite Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt using with vite Summa...
CORS Middleware: Using with Vite
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#using-with-vite
Summary
When using Hono with Vite, you should disable Vite's built-in CORS feature by setting server.cors to false in your vite.config.ts. This prevents conflicts with Hono's CORS middleware. ```ts // vite.config.ts import { cloudflare } f...
Content
When using Hono with Vite, you should disable Vite's built-in CORS feature by setting server.cors to false in your vite.config.ts. This prevents conflicts with Hono's CORS middleware.
// vite.config.ts
import { cloudflare } from '@cloudflare/vite-plugin'
import { defineConfig } from 'vite'
export default defineConfig({
server: {
cors: false, // disable Vite's built-in CORS setting
},
plugins: [cloudflare()],
})
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#using-with-vite",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / CORS Middleware > Using with Vite",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 196,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "CORS Middleware: Using with Vite",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}