/Knowledge/sources/honojs__hono/llms-full/cookie-helper-secure-and-host-prefix--c51cf4eb93d3.md
Cookie Helper: __Secure- and __Host- prefix - hono-docs
Cookie Helper: Secure and Host prefix Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt secure and host...
Cookie Helper: __Secure- and __Host- prefix
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#secure-and-host-prefix
Summary
The Cookie helper supports __Secure- and __Host- prefixes for cookie names. If you want to verify if the cookie name has a prefix, specify the prefix option. ```ts const securePrefixCookie = getCookie(c, 'yummy_cookie', 'secure') con...
Content
The Cookie helper supports __Secure- and __Host- prefixes for cookie names.
If you want to verify if the cookie name has a prefix, specify the prefix option.
const securePrefixCookie = getCookie(c, 'yummy_cookie', 'secure')
const hostPrefixCookie = getCookie(c, 'yummy_cookie', 'host')
const securePrefixSignedCookie = await getSignedCookie(
c,
secret,
'fortune_cookie',
'secure'
)
const hostPrefixSignedCookie = await getSignedCookie(
c,
secret,
'fortune_cookie',
'host'
)
Also, if you wish to specify a prefix when setting the cookie, specify a value for the prefix option.
setCookie(c, 'delicious_cookie', 'macha', {
prefix: 'secure', // or `host`
})
await setSignedCookie(
c,
'delicious_cookie',
'macha',
'secret choco chips',
{
prefix: 'secure', // or `host`
}
)
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#secure-and-host-prefix",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Cookie Helper > `__Secure-` and `__Host-` prefix",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 725,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Cookie Helper: __Secure- and __Host- prefix",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}