/Knowledge/sources/honojs__hono/llms-full/routing-routing-with-hostname--fcf9ee8ba544.md
Routing: Routing with hostname - hono-docs
Routing: Routing with hostname Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt routing with hostname S...
Routing: Routing with hostname
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#routing-with-hostname
Summary
It works fine if it includes a hostname. ```ts twoslash import { Hono } from 'hono' // ---cut--- const app = new Hono({ getPath: (req) => req.url.replace(/^https?:/([^?]+).*$/, '$1'), }) app.get('/www1.example.com/hello', (c) => c.text(...
Content
It works fine if it includes a hostname.
import { Hono } from 'hono'
// ---cut---
const app = new Hono({
getPath: (req) => req.url.replace(/^https?:\/([^?]+).*$/, '$1'),
})
app.get('/www1.example.com/hello', (c) => c.text('hello www1'))
app.get('/www2.example.com/hello', (c) => c.text('hello www2'))
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#routing-with-hostname",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Routing > Routing with hostname",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 601,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Routing: Routing with hostname",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}