/Knowledge/sources/honojs__hono/llms-full/ip-restriction-middleware-usage--4d673d1f7482.md

IP Restriction Middleware: Usage - hono-docs

IP Restriction Middleware: Usage Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt usage Summary For you...

IP Restriction Middleware: Usage

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

Summary

For your application running on Bun, if you want to allow access only from local, you can write it as follows. Specify the rules you want to deny in the denyList and the rules you want to allow in the allowList. ```ts import { Hono }...

Content

For your application running on Bun, if you want to allow access only from local, you can write it as follows. Specify the rules you want to deny in the denyList and the rules you want to allow in the allowList.

import { Hono } from 'hono'
import { getConnInfo } from 'hono/bun'
import { ipRestriction } from 'hono/ip-restriction'

const app = new Hono()

app.use(
  '*',
  ipRestriction(getConnInfo, {
    denyList: [],
    allowList: ['127.0.0.1', '::1'],
  })
)

app.get('/', (c) => c.text('Hello Hono!'))

Pass the getConninfo from the ConnInfo helper appropriate for your environment as the first argument of ipRestriction. For example, for Deno, it would look like this:

import { getConnInfo } from 'hono/deno'
import { ipRestriction } from 'hono/ip-restriction'

//...

app.use(
  '*',
  ipRestriction(getConnInfo, {
    // ...
  })
)

Metadata

{
  "chunk_index": 0,
  "citation": "https://hono.dev/llms-full.txt#usage",
  "coverage_role": "overview",
  "qualified_title": "Hono / llms-full / IP Restriction Middleware > Usage",
  "retrieved_at": "2026-07-02T05:51:01Z",
  "section_index": 135,
  "source_id": "/honojs/hono",
  "source_type": "llms_full",
  "target_label": "llms-full",
  "title": "IP Restriction Middleware: Usage",
  "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/ip-restriction-middleware-usage--4d673d1f7482.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.