-
Notifications
You must be signed in to change notification settings - Fork 427
Description
Hey Netlify ❤️,
As I've said before, thanks for all your work! 🙌 Here is a tiny issue. I'm going to submit a corresponding PR in a few minutes.
Describe the bug
In Netlify, you can set a custom 404 page by putting a 404.html
file into the publish folder (e.g., public
or whatever is specified in netlify.toml
). This custom 404 page is not picked up by netlify dev. For it to work in netlify dev, the custom 404.html
file must be in the root folder. This is inconsistent with Netlify in production.
To Reproduce
git clone https://github.com/FinnWoelm/netlify-404
cd netlify-404
netlify dev
Visit http://localhost:8888/this-file-does-not-exist and see Not found
instead of the custom 404.html page:
Configuration
- If possible, please copy/paste below your
netlify.toml
.
[build]
publish = "public"
- Please enter the following command in a terminal and copy/paste its output:
System:
OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
CPU: (4) x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
Memory: 256.93 MB / 7.68 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
Yarn: 1.22.5 - /usr/bin/yarn
npm: 6.14.7 - ~/.nvm/versions/node/v12.14.1/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
npmGlobalPackages:
netlify-cli: 2.59.1
Expected behavior
My custom error page should be visible, like it is on Netlify when visiting https://netlify-404.netlify.app/this-file-does-not-exist:
Additional context
Working on a PR right now. This issue is just here for context.
The PR should only be a single change:
Line 383 in 0762d6d
notFound: '404.html', |
The 404.html needs to be prepended by the public folder path, similar to here:
Line 76 in 0762d6d
const maybe404Page = path.resolve(publicFolder, '404.html') |
Will let you know if I run into any issues with the PR! 👍