From b7388dc298baa64649ce2ea7cfa7db26dd8f8dd4 Mon Sep 17 00:00:00 2001 From: Ali Amori Kadhim Date: Fri, 21 Jun 2024 12:16:15 +0200 Subject: [PATCH] chore(pdc-frontend): set the not-found page HTTP header to 404 --- .../src/app/[locale]/(rootLayout)/[...not-found]/page.tsx | 2 ++ apps/pdc-frontend/src/app/[locale]/(rootLayout)/not-found.tsx | 2 ++ 2 files changed, 4 insertions(+) diff --git a/apps/pdc-frontend/src/app/[locale]/(rootLayout)/[...not-found]/page.tsx b/apps/pdc-frontend/src/app/[locale]/(rootLayout)/[...not-found]/page.tsx index 3037ff8f..f6a2837f 100644 --- a/apps/pdc-frontend/src/app/[locale]/(rootLayout)/[...not-found]/page.tsx +++ b/apps/pdc-frontend/src/app/[locale]/(rootLayout)/[...not-found]/page.tsx @@ -8,6 +8,8 @@ import { fetchData } from '@/util/fetchData'; import { GetNotFoundPageQuery } from '../../../../../gql/graphql'; const NotFoundPage = async ({ params: { locale } }: { params: { locale: string } }) => { + const response = new Response(null, { status: 404 }); + response.headers.set('X-Not-Found', 'true'); const { t } = await useTranslation(locale, ['common']); const { data } = await fetchData<{ data: GetNotFoundPageQuery }>({ url: createStrapiURL(), diff --git a/apps/pdc-frontend/src/app/[locale]/(rootLayout)/not-found.tsx b/apps/pdc-frontend/src/app/[locale]/(rootLayout)/not-found.tsx index 09cb970a..f59e3007 100644 --- a/apps/pdc-frontend/src/app/[locale]/(rootLayout)/not-found.tsx +++ b/apps/pdc-frontend/src/app/[locale]/(rootLayout)/not-found.tsx @@ -11,6 +11,8 @@ import { useTranslation } from '../../i18n'; import { fallbackLng } from '../../i18n/settings'; const NotFoundPage = async () => { + const response = new Response(null, { status: 404 }); + response.headers.set('X-Not-Found', 'true'); const locale = cookies().get('i18next')?.value; const { t } = await useTranslation(locale || fallbackLng, ['common']); const { data } = await fetchData<{ data: GetNotFoundPageQuery }>({