/Knowledge/sources/honojs__hono/llms-full/ip-restriction-middleware-error-handling--47425ff8d1e3.md
IP Restriction Middleware: Error handling - hono-docs
IP Restriction Middleware: Error handling Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt error handli...
IP Restriction Middleware: Error handling
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#error-handling
Summary
To customize the error, return a Response in the third argument. ts app.use( '*', ipRestriction( getConnInfo, { denyList: ['192.168.2.0/24'], }, async (remote, c) => { return c.text(`Blocking access from ${remote.addr}`, 403) } ) )
Content
To customize the error, return a Response in the third argument.
app.use(
'*',
ipRestriction(
getConnInfo,
{
denyList: ['192.168.2.0/24'],
},
async (remote, c) => {
return c.text(`Blocking access from ${remote.addr}`, 403)
}
)
)
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#error-handling",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / IP Restriction Middleware > Error handling",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 139,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "IP Restriction Middleware: Error handling",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}