local-web-server icon indicating copy to clipboard operation
local-web-server copied to clipboard

Custom 404 page

Open stephenjwatkins opened this issue 2 years ago • 1 comments

I'm using local-web-server to serve a SSG-built Next.js site. Everything's working well except for when I try to access a page that's not found. I'd like to serve the Next.js-generated 404.html file instead of the bare Not Found text. Is there a way to do this out of the box with the local-web-server CLI?

stephenjwatkins avatar Jun 16 '22 15:06 stephenjwatkins

Hi, sorry for the slow reply.. Currently, there is no built-in feature to set a custom 404 response but I think there should be..

It's simple to create a custom 404 response using custom middleware (see the wiki), when I get a few hours spare I'll look into creating an example of how this is done..

75lb avatar Jun 28 '22 22:06 75lb