readthedocs / sphinx-notfound-page

Create a custom 404 page with absolute URLs hardcoded
https://sphinx-notfound-page.readthedocs.io/
MIT License
48 stars 32 forks source link

Can't see 404.html with sphinx-autobuild. #227

Closed ShaiAvr closed 7 months ago

ShaiAvr commented 9 months ago

I am using sphinx-autobuild to spawn a local server that serves my docs. I found out about this extension recently and decided to give it a shot since the default not-found page looks like this:

Screenshot 2023-11-11 140319

which doesn't look good, to say the least. I followed the instructions on the installation page and when running sphinx-autobuild, I see the file 404.html is generated in the build directory. However, navigating to an unknown location still shows me the default 404 page I showed above. I don't understand what I am doing wrong. I see messages in the terminal that the server returns 404 codes, so I think sphinx-autobuild supports 404 requests.

What am I missing here? I am using the PyData Sphinx theme if that is important to note. Since sphinx-autobuild is a popular option for running local documentation servers, I think the docs should explain how to set up this extension with it since the documented steps don't seem to be enough.

stsewd commented 9 months ago

Hi, this extension works if the server/hosting you are using supports serving the root's 404.html file when there is 404, like Read the Docs or GitHub pages. sphinx-autobuild's server doesn't support this.

ShaiAvr commented 9 months ago

Then how can I test this extension locally? I don’t have a Read the Docs host at the moment. Is there a way to configure sphinx-autobuild to pick up the 404.html file?

stsewd commented 9 months ago

@ShaiAvr to visualize the file, you can just hit the 404.html directly. You can't test it from another path locally.