Skip to content

Conversation

FinnWoelm
Copy link
Contributor

- Summary

In Netlify, you can set a custom 404 page by putting a 404.html file inside the publish folder (e.g., public or whatever is specified in netlify.toml).

Until now, this custom 404 page was not picked up by netlify dev. For it to work in netlify dev, the custom 404.html file had to be in the root folder.

This PR makes the behavior of netlify dev consistent with Netlify in production by using the custom 404.html page in the publish folder.

Fixes: #1158

- Test plan

I first added a test to tests/command.dev.test.js. I ran the test and confirmed that it failed. Then I implemented the fix. I reran the test and the test passed.

Screenshot from 2020-08-27 21-09-15

Screenshot from 2020-08-27 21-17-13

I ran npm run test and everything came back green.

- Description for the changelog

Fix: Use 404.html page in publish folder (#1158)

- A picture of a cute animal (not mandatory but encouraged)

WhatsApp Image 2019-12-25 at 2 04 28 PM (3)

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). Until now, this custom 404 page was not picked up by netlify dev. For it to work in netlify dev, the custom 404.html file had to be in the root folder. This commit makes the behavior of netlify dev consistent with Netlify in production by using the custom 404.html page in the publish folder. Fixes: netlify#1158
@netlify
Copy link

netlify bot commented Aug 27, 2020

Deploy request for cli accepted.

Accepted with commit cccf547

https://app.netlify.com/sites/cli/deploys/5f4809e73c62050007ef4dfc

@erezrokah erezrokah added the type: bug code to address defects in shipped code label Aug 30, 2020
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FinnWoelm you're on 🔥

@erezrokah erezrokah merged commit 913ea70 into netlify:master Aug 30, 2020
FinnWoelm added a commit to netlify/next-on-netlify that referenced this pull request Sep 6, 2020
Netlify dev now picks up the custom 404.html from the publish folder (matching the behavior of deployment on Netlify). We can remove the workaround where we copied the 404.html to the project root. Fix in netlify/cli: netlify/cli#1159
FinnWoelm added a commit to netlify/next-on-netlify that referenced this pull request Sep 6, 2020
- Add support for base64 encoding in responses returned from SSR pages and API endpoints - Reduce the number of rewrites generated by skipping SSG & HTML pages with static routing. These pages are routed automatically by Netlify ([#26](#26)) - Limit the default number of lines of build output to 50. More or fewer lines can be shown by running `next-on-netlify` with the option `--max-log-lines XX`. See `next-on-netlify --help` and [this comment](#26 (comment)). - Remove workaround for making `404.html` work with `netlify dev`. The workaround is no longer required because [`netlify dev` has been patched](netlify/cli#1159).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
2 participants