404.html 这个文件,这样可以保证用户访问你网站中的无效路径的时候,正常返回 404 响应,否则可能会返回首页的内容,从而产生一些意外的现象。404.html,Cloudflare 会默认这个项目是一个单页应用(SPA),这时所有无效路径都会用根路径的内容进行响应。参考文档:If your project does not include a top-level404.htmlfile, Pages assumes that you are deploying a single-page application. This includes frameworks like React, Vue, and Angular. Pages' default single-page application behavior matches all incoming paths to the root (/), allowing you to capture URLs like/aboutor/helpand respond to them from within your SPA.
404.html,哪怕你用 https://yourwebsite.com/asihdsebfjkj这种无效路径访问你的项目,页面仍然可以正常显示。