Skip to content

non-existent wiki pages are not 404 errors

Summary

When opening a non-existent wiki page, we do not get served with a 404, but instead we get the page editing dialogs.

This has many annoying consequences:

  1. link checkers do not work against wikis: even if a wiki link is misspelled or mistyped, the link checker (e.g. link checker) will fail to notice the error because GitLab will not return an error
  2. incorrect wiki page URLs end up in web browser history, which can confuse users

Steps to reproduce

  1. create a GitLab project
  2. in the wiki section, create the homepage and link to the foo page like this ([foo](foo))
  3. save the page

Example Project

https://gitlab.com/anarcat/test/-/wikis/non-404

What is the current bug behavior?

the [404](404) link points to https://gitlab.com/anarcat/test/-/wikis/404 which is not an actual 404 but the "Create New Page" form.

What is the expected correct behavior?

a 404 status page should be served. i think it could be the Create new page form too, but it still need to return the right status code.

Relevant logs and/or screenshots

screenshot of a 200 status code on "Create new page"

Output of checks

This bug happens on GitLab.com

Possible fixes

I haven't looked at the source for a fix for this yet.

Implementation Guide

Some investigation will be required but it should be relatively straightfoward to send back the page with a 404 status code instead of 200. When not logged in a different page is rendered, so that will need to be covered also and could be a simple first iteration.

This MR may be helpful: !88009 (closed)

Edited by John Hope