admin管理员组文章数量:1026989
I'm working on a Next.js project using the pages router, and the official documentation shows that this can be done by creating a page at pages/404.tsx
:
export default function Custom404() {
return <h1>404 - Page Not Found</h1>
}
How can I access the HTTP request headers here? Normally I would do it with the getServerSideProps
, but the documentation says 404.js Cannot Have getInitialProps/getServerSideProps.
I just want to get the "accept-language" header so I the display text can be localized.
I'm working on a Next.js project using the pages router, and the official documentation shows that this can be done by creating a page at pages/404.tsx
:
export default function Custom404() {
return <h1>404 - Page Not Found</h1>
}
How can I access the HTTP request headers here? Normally I would do it with the getServerSideProps
, but the documentation says 404.js Cannot Have getInitialProps/getServerSideProps.
I just want to get the "accept-language" header so I the display text can be localized.
本文标签: nextjsHow can I access request headers in my custom 404 page (with the pages router)Stack Overflow
版权声明:本文标题:next.js - How can I access request headers in my custom 404 page (with the pages router)? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745670710a2162440.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论