0

Created a simple 404.js page

import React from 'react'

import Error from 'next/error'

export default function Page404() {
  return <Error statusCode={404} />
}

In [[...page]].tsx:

export async function getStaticPaths() { ... }

export async function getStaticProps({ ... } : StaticProps) {
  ...
  if (!page) {
    return {
      notFound: true,
    }
  }
  ...
}

If I enter some dummy URL, error page is shown, but http status is 200. How can I change it to 404?

Aluan Haddad
  • 29,886
  • 8
  • 72
  • 84
DraganS
  • 2,621
  • 1
  • 27
  • 40

0 Answers0