router icon indicating copy to clipboard operation
router copied to clipboard

Example "basic-ssr-file-based": HTTP status code not set to 404 when page not found

Open kcoet opened this issue 1 year ago • 1 comments

Describe the bug

Using this example: https://github.com/TanStack/router/tree/main/examples/react/basic-ssr-file-based

On a dynamic single post route, when NotFound is thrown, the http status code is not set to 404. I've scoured the documentation, it seems there is currently no way to do this.

I think this is necessary for SEO, so that non-existent pages are not indexed by search engines.

Your Example Website or App

https://github.com/TanStack/router/tree/main/examples/react/basic-ssr-file-based

Steps to Reproduce the Bug or Issue

Thrown NotFound on loader, see http status code.

Expected behavior

when visiting a non-existent page, the HTTP status code should be set to 404.

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Browser: Chrome
  • Version: 120.0.6099.225

Additional context

No response

kcoet avatar Jan 26 '24 11:01 kcoet

We're working on some new not found APIs, see #1048, that should allow for this

iDarkLightning avatar Jan 26 '24 13:01 iDarkLightning