lwsjs / local-web-server

A lean, modular web server for rapid full-stack development.
MIT License
1.2k stars 85 forks source link

Custom 404 page #173

Open stephenjwatkins opened 2 years ago

stephenjwatkins commented 2 years ago

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?

75lb commented 2 years ago

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..