Użyj `cookies()` i `headers()` z `next/headers` w Server Component. Czytają one dane z requestu po stronie serwera; w przeglądarce cookies czyta się inaczej (a headerów nie masz w ten sam sposób).
import { cookies, headers } from 'next/headers'
export default function Page() {
const cookieStore = cookies()
const theme = cookieStore.get('theme')?.value
const ua = headers().get('user-agent')
return <div>{theme} {ua}</div>
}