v4.12.3
- fix(validator): prevent type diff bug in form data parsing by @EdamAme-x in https://github.com/honojs/hono/pull/4753
- fix(jwt): use
Math.floorinstead of bitwise OR for safe timestamp by @EdamAme-x in https://github.com/honojs/hono/pull/4754 - fix(jwt): fix
JwtVariablesforContextVariableMapby @yusukebe in https://github.com/honojs/hono/pull/4764 - fix(types): remove DOM type dependencies from ClientResponse and request method by @YevheniiKotyrlo in https://github.com/honojs/hono/pull/4768
- fix(types): correct middleware types by @hmnd in https://github.com/honojs/hono/pull/4774
- fix(jwt): prevent memory leak by avoiding mutation of options object by @EdamAme-x in https://github.com/honojs/hono/pull/4759
- @YevheniiKotyrlo made their first contribution in https://github.com/honojs/hono/pull/4768
- @hmnd made their first contribution in https://github.com/honojs/hono/pull/4774
Full Changelog: https://github.com/honojs/hono/compare/v4.12.2...v4.12.3
v4.12.2
Fixed incorrect handling of X-Forwarded-For in the AWS Lambda adapter behind ALB that could allow IP-based access control bypass. The detail: https://github.com/honojs/hono/security/advisories/GHSA-xh87-mx6m-69f3
Thanks @EdamAme-x
- fix(context): revert PR #4707 by @yusukebe in https://github.com/honojs/hono/pull/4757
Full Changelog: https://github.com/honojs/hono/compare/v4.12.1...v4.12.2
v4.12.1
- fix(client): export
ApplyGlobalResponsefromhono/clientby @sushichan044 in https://github.com/honojs/hono/pull/4743
Full Changelog: https://github.com/honojs/hono/compare/v4.12.0...v4.12.1
v4.12.0
Hono v4.12.0 is now available!
This release includes new features for the Hono client, middleware improvements, adapter enhancements, and significant performance improvements to the router and context.
The Hono client now has a $path() method that returns the path string instead of a full URL. This is useful when you need just the path portion for routing or key-based operations:
const client = hc<typeof app>('http://localhost:8787')
// Get the path string
const path = client.api.posts.$path()
// => '/api/posts'
// With path parameters
const postPath = client.api.posts[':id'].$path({
param: { id: '123' },
})
// => '/api/posts/123'
// With query parameters
const searchPath = client.api.posts.$path({
query: { filter: 'test' },
})
// => '/api/posts?filter=test'
Unlike $url() which returns a URL object, $path() returns a plain path string, making it convenient for use with routers or as cache keys.
Thanks @ShaMan123!
The new ApplyGlobalResponse type helper allows you to add global error response types to all routes in the RPC client. This is useful for typing common error responses from app.onError() or global middlewares:
const app = new Hono()
.get('/api/users', (c) => c.json({ users: ['alice', 'bob'] }, 200))
.onError((err, c) => c.json({ error: err.message }, 500))
type AppWithErrors = ApplyGlobalResponse<
typeof app,
{
401: { json: { error: string; message: string } }
500: { json: { error: string; message: string } }
}
>
const client = hc<AppWithErrors>('http://api.example.com')
// Now client knows about both success and error responses
const res = await client.api.users.$get()
// InferResponseType includes { users: string[] } | { error: string; message: string }
Thanks @mohankumarelec!
A new redirectPlugin for SSG generates static HTML redirect pages for HTTP redirect responses (301, 302, 303, 307, 308):
import { toSSG } from 'hono/ssg'
import { defaultPlugin, redirectPlugin } from 'hono/ssg'
const app = new Hono()
app.get('/old', (c) => c.redirect('/new'))
app.get('/new', (c) => c.html('New Page'))
// redirectPlugin must be placed before defaultPlugin
await toSSG(app, fs, {
plugins: [redirectPlugin(), defaultPlugin()],
})
The generated redirect pages include a <meta http-equiv="refresh"> tag, a canonical link, and a robots noindex meta tag.
Thanks @3w36zj6!
The Basic Auth middleware now supports an onAuthSuccess callback that is invoked after successful authentication. This allows you to set context variables or perform logging without re-parsing the Authorization header:
app.use(
'/auth/*',
basicAuth({
username: 'hono',
password: 'ahotproject',
onAuthSuccess: (c, username) => {
c.set('user', { name: username, role: 'admin' })
console.log(`User ${username} authenticated`)
},
})
)
The callback also works with async functions and the verifyUser mode.
Thanks @AprilNEA!
getConnInfo() is now available for three additional adapters:
// AWS Lambda (supports API Gateway v1, v2, and ALB)
import { handle, getConnInfo } from 'hono/aws-lambda'
// Cloudflare Pages
import { handle, getConnInfo } from 'hono/cloudflare-pages'
// Netlify
import { handle, getConnInfo } from 'hono/netlify'
app.get('/', (c) => {
const info = getConnInfo(c)
return c.text(`Your IP: ${info.remote.address}`)
})
Thanks @rokasta12!
The trailing slash middleware now supports an alwaysRedirect option. When enabled, the middleware redirects before executing handlers, which fixes the issue where trailing slash handling doesn't work with wildcard routes:
app.use(trimTrailingSlash({ alwaysRedirect: true }))
app.get('/my-path/*', async (c) => {
return c.text('wildcard')
})
// /my-path/something/ will be redirected to /my-path/something
// before the wildcard handler is executed
The normalizeLanguage function in the language middleware now supports RFC 4647 Lookup-based progressive truncation. Locale codes like ja-JP will match ja when only the base language is in supportedLanguages:
app.use(
'/*',
languageDetector({
supportedLanguages: ['en', 'ja'],
fallbackLanguage: 'en',
order: ['cookie', 'header'],
})
)
// Accept-Language: ja-JP → matches 'ja'
// Accept-Language: ko-KR → falls back to 'en'
Thanks @sorafujitani!
The ExecutionContext type now includes an exports property for Cloudflare Workers. You can use module augmentation to type it with Wrangler's generated types:
import 'hono'
declare module 'hono' {
interface ExecutionContext {
readonly exports: Cloudflare.Exports
}
}
Thanks @toreis-up!
The TrieRouter has been significantly optimized with reduced spread syntax usage, O(1) hasChildren checks, lazy regular expression generation, and removal of redundant processes:
| Route | Node.js | Deno | Bun |
|---|---|---|---|
short static GET /user |
1.70x | 1.40x | 1.34x |
dynamic GET /user/lookup/username/hey |
1.38x | 1.69x | 1.51x |
wildcard GET /static/index.html |
1.51x | 1.72x | 1.43x |
| all together | 1.58x | 1.60x | 1.82x |
Thanks @EdamAme-x!
c.json() now has the same fast path optimization as c.text(). When no custom status, headers, or finalized state exists, the Response is created directly without allocating a Headers object:
// This common pattern is now faster
return c.json({ message: 'Hello' })
Benchmark results:
| Metric | Before | After | Change |
|---|---|---|---|
| Reqs/sec | 92,268 | 95,244 | +3.2% |
| Latency | 5.42ms | 5.25ms | -3.1% |
| Throughput | 17.24MB/s | 19.07MB/s | +10.6% |
Thanks @mgcrea!
- feat(client): Add
ApplyGlobalResponsetype helper for RPC Client https://github.com/honojs/hono/pull/4556 - feat(ssg): add redirect plugin https://github.com/honojs/hono/pull/4599
- feat(client): $path https://github.com/honojs/hono/pull/4636
- feat(basic-auth): add context key and callback options https://github.com/honojs/hono/pull/4645
- feat(adapter): add getConnInfo for AWS Lambda, Cloudflare Pages, and Netlify https://github.com/honojs/hono/pull/4649
- feat(trailing-slash): add
alwaysRedirectoption to support wildcard routes https://github.com/honojs/hono/pull/4658 - feat(language): add progressive locale code truncation to normalizeLanguage https://github.com/honojs/hono/pull/4717
- feat(types): Add exports field to ExecutionContext https://github.com/honojs/hono/pull/4719
- perf(context): add fast path to c.json() matching c.text() optimization https://github.com/honojs/hono/pull/4707
- perf(trie-router): improve performance (1.5x ~ 2.0x) https://github.com/honojs/hono/pull/4724
- perf(context): use
createResponseInstancefor new Response https://github.com/honojs/hono/pull/4733
- fix(jsx/dom): handle empty arrays in render children loop by @mixelburg in https://github.com/honojs/hono/pull/4729
- perf(jsx/dom): flatten children once at the start to avoid repeated flattening by @usualoma in https://github.com/honojs/hono/pull/4730
- fix(client): skip undefined values in form data serialization by @aidenlx in https://github.com/honojs/hono/pull/4732
- feat(client): Add
ApplyGlobalResponsetype helper for RPC Client by @mohankumarelec in https://github.com/honojs/hono/pull/4556 - feat(ssg): add redirect plugin by @3w36zj6 in https://github.com/honojs/hono/pull/4599
- feat(client): $path by @ShaMan123 in https://github.com/honojs/hono/pull/4636
- feat(basic-auth): add context key and callback options by @AprilNEA in https://github.com/honojs/hono/pull/4645
- feat(adapter): add getConnInfo for AWS Lambda, Cloudflare Pages, and Netlify by @rokasta12 in https://github.com/honojs/hono/pull/4649
- feat(trailing-slash): add
alwaysRedirectoption to support wildcard routes by @yusukebe in https://github.com/honojs/hono/pull/4658 - perf(context): add fast path to c.json() matching c.text() optimization by @mgcrea in https://github.com/honojs/hono/pull/4707
- feat(language): add progressive locale code truncation to normalizeLanguage by @sorafujitani in https://github.com/honojs/hono/pull/4717
- feat(types): Add exports field to ExecutionContext by @toreis-up in https://github.com/honojs/hono/pull/4719
- perf(trie-router): improve performance (1.5x ~ 2.0x) by @EdamAme-x in https://github.com/honojs/hono/pull/4724
- perf(context): use
createResponseInstancefor new Response by @yusukebe in https://github.com/honojs/hono/pull/4733 - Next by @yusukebe in https://github.com/honojs/hono/pull/4735
- @mixelburg made their first contribution in https://github.com/honojs/hono/pull/4729
- @aidenlx made their first contribution in https://github.com/honojs/hono/pull/4732
- @mohankumarelec made their first contribution in https://github.com/honojs/hono/pull/4556
- @ShaMan123 made their first contribution in https://github.com/honojs/hono/pull/4636
- @rokasta12 made their first contribution in https://github.com/honojs/hono/pull/4649
- @mgcrea made their first contribution in https://github.com/honojs/hono/pull/4707
Full Changelog: https://github.com/honojs/hono/compare/v4.11.10...v4.12.0
v4.11.10
- fix: fixed to be more properly timing safe (Merge commit from fork 91def7ca)
Full Changelog: https://github.com/honojs/hono/compare/v4.11.9...v4.11.10
v4.11.9
- fix(url): ignore fragment identifiers in getPath() by @sano-suguru in https://github.com/honojs/hono/pull/4627
- fix: determine if rendered or not by
node.vC[0]instead of referring tonode.pPby @usualoma in https://github.com/honojs/hono/pull/4663
Full Changelog: https://github.com/honojs/hono/compare/v4.11.8...v4.11.9
v4.11.8
- fix(jsx): preserve context when using await before html helper by @kaigritun in https://github.com/honojs/hono/pull/4662
- fix(bearer-auth): make auth-scheme case-insensitive by @bytaesu in https://github.com/honojs/hono/pull/4659
- @kaigritun made their first contribution in https://github.com/honojs/hono/pull/4662
Full Changelog: https://github.com/honojs/hono/compare/v4.11.7...v4.11.8
v4.11.7
This release includes security fixes for multiple vulnerabilities in Hono and related middleware. We recommend upgrading if you are using any of the affected components.
Fixed an IPv4 address validation bypass that could allow IP-based access control to be bypassed under certain configurations.
Fixed an issue where responses marked with Cache-Control: private or no-store could be cached, potentially leading to information disclosure on some runtimes.
Fixed an issue that could allow unintended access to internal asset keys when serving static files with user-controlled paths.
Fixed a reflected Cross-Site Scripting (XSS) issue in the ErrorBoundary component that could occur when untrusted strings were rendered without proper escaping.
Users are encouraged to upgrade to this release, especially if they:
- Use IP Restriction Middleware
- Use Cache Middleware on Deno, Bun, or Node.js
- Use Serve Static Middleware with user-controlled paths on Cloudflare Workers
- Render untrusted data inside
ErrorBoundarycomponents
-
IP Restriction Middleware – IPv4 address validation bypass
- Advisory: https://github.com/honojs/hono/security/advisories/GHSA-r354-f388-2fhh
- CVE: CVE-2026-24398
-
Cache Middleware ignores
Cache-Control: private- Advisory: https://github.com/honojs/hono/security/advisories/GHSA-6wqw-2p9w-4vw4
- CVE: CVE-2026-24472
-
Serve Static Middleware (Cloudflare Workers adapter) – Arbitrary key read
- Advisory: https://github.com/honojs/hono/security/advisories/GHSA-w332-q679-j88p
- CVE: CVE-2026-24473
-
hono/jsx
ErrorBoundary– Cross-Site Scripting (XSS)- Advisory: https://github.com/honojs/hono/security/advisories/GHSA-9r54-q6cx-xmh5
- CVE: Pending
Full Changelog: https://github.com/honojs/hono/compare/v4.11.6...v4.11.7
v4.11.6
- refactor: use
unique symbolfor more accurate typing. by @usualoma in https://github.com/honojs/hono/pull/4651 - docs: align CODE_OF_CONDUCT.md wording with Contributor Covenant by @sano-suguru in https://github.com/honojs/hono/pull/4630
- fix(sse): handle
\rand\r\nline endings in writeSSE by @AprilNEA in https://github.com/honojs/hono/pull/4644 - feat(bun): export getBunServer by @artemtam in https://github.com/honojs/hono/pull/4626
- @sano-suguru made their first contribution in https://github.com/honojs/hono/pull/4630
- @AprilNEA made their first contribution in https://github.com/honojs/hono/pull/4644
- @artemtam made their first contribution in https://github.com/honojs/hono/pull/4626
Full Changelog: https://github.com/honojs/hono/compare/v4.11.5...v4.11.6
v4.11.5
- fix(client): exclude $all from ClientRequest type by @paveg in https://github.com/honojs/hono/pull/4611
- refactor(jwks): mark allowedAlgorithms, so the user can pass a `const… by @nikeee in https://github.com/honojs/hono/pull/4641
- feat(jwt): export
AlgorithmTypesby @yusukebe in https://github.com/honojs/hono/pull/4642
- @paveg made their first contribution in https://github.com/honojs/hono/pull/4611
- @nikeee made their first contribution in https://github.com/honojs/hono/pull/4641
Full Changelog: https://github.com/honojs/hono/compare/v4.11.4...v4.11.5