/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-secure-and-host-pre-f7fb5b5d83a4-secure-and-host-prefix-s0725-c0000.md
`__Secure-` and `__Host-` prefix - hono-docs
Secure and Host prefix Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt secure and host prefix Sum...
__Secure- and __Host- prefix
Source evidence: /Sources/raw/honojshono/honojshono.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`
}
)