/Knowledge/sources/honojs__hono/llms-full/cors-middleware-usage--part-02--ec0bb10fe71f.md

CORS Middleware: Usage (part 02) - hono-docs

CORS Middleware: Usage (part 02) Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt usage Summary Dynamic...

CORS Middleware: Usage (part 02)

Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#usage

Summary

Dynamic allowed methods based on origin: ```ts app.use( '/api5/', cors({ origin: (origin) => origin === 'https://example.com' ? origin : '', // c is a Context object allowMethods: (origin, c) => origin === 'https://example.com' ? [...

Content

Dynamic allowed methods based on origin:

app.use(
  '/api5/*',
  cors({
    origin: (origin) =>
      origin === 'https://example.com' ? origin : '*',
    // `c` is a `Context` object
    allowMethods: (origin, c) =>
      origin === 'https://example.com'
        ? ['GET', 'HEAD', 'POST', 'PATCH', 'DELETE']
        : ['GET', 'HEAD'],
  })
)

Metadata

{
  "chunk_index": 1,
  "citation": "https://hono.dev/llms-full.txt#usage",
  "coverage_role": "overview",
  "qualified_title": "Hono / llms-full / CORS Middleware > Usage (2)",
  "retrieved_at": "2026-07-02T05:51:01Z",
  "section_index": 187,
  "source_id": "/honojs/hono",
  "source_type": "llms_full",
  "target_label": "llms-full",
  "title": "CORS Middleware: Usage (part 02)",
  "upstream_url": "https://hono.dev/llms-full.txt",
  "version": "2026"
}
Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Knowledge/sources/honojs__hono/llms-full/cors-middleware-usage--part-02--ec0bb10fe71f.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.