Hello I Have Next js 14 App Router and I have custom notFound page and the page return 200
Unanswered
Black carpenter ant posted this in #help-forum
Black carpenter antOP
Hello I Have Next js 14 App Router and I have custom notFound page and the page return 200 status code. How Can I return always status code 404. How to do it?
46 Replies
Black carpenter antOP
Yes I checked it @Double-striped Thick-knee
but i didnt find correct answer
Double-striped Thick-knee
are you getting 200 status code in notFound page?
@Black carpenter ant
Black carpenter antOP
yes
I wanna set 404 code error instead 200 for custom notFound page
Double-striped Thick-knee
where did you put your custom notFound page. it should be inside app folder. and name should be
not-found.tsx/jsxBlack carpenter antOP
yes
i have it
in app/not-found.tsx
and I return my custom not found page
@Black carpenter ant and I return my custom not found page
Double-striped Thick-knee
what do you mean? can you show me what you're doing
Black carpenter antOP
when i open product (it is dynamic)
I get code status 200
with my custom content
I wanna get code status 404 with my custom content
but in documentation next "Along with serving a custom UI, Next.js will return a 200 HTTP status code for streamed responses"
Custom ui not found pages has code status 200, How can i change it to 404?
Double-striped Thick-knee
I do get status 404 for my custom notFound pages. can you visit a random page to see it's status code
Black carpenter antOP
in next 14 app router?
@Black carpenter ant in next 14 app router?
Double-striped Thick-knee
yeah
Black carpenter antOP
do you use loading also?
loading.tsx/jsx from next?
Double-striped Thick-knee
wait. let me check
Black carpenter antOP
Did you change something in middleware?
@Black carpenter ant Did you change something in middleware?
Double-striped Thick-knee
I did nothing extra
Black carpenter antOP
could you show me your code
and show console in nextjs when you open 404?
Double-striped Thick-knee
look
Black carpenter antOP
could you show me you not-found tsx?
waaat
i use also next-inlt for internalization (for multi languages)
maybe it is problem
but im not sure
@Black carpenter ant could you show me you not-found tsx?
Double-striped Thick-knee
you could try to recreate the issue in a new project
Black carpenter antOP
is it a new project right?
could you show me your package json?
@Black carpenter ant is it a new project right?
Double-striped Thick-knee
yeah it's completely new.
Black carpenter antOP
okay thx
im gonna test a create new projec
and i need to check it
intersting..
Double-striped Thick-knee
let us know what caused your issue and solution