Problem/Motivation
When a default 404 page is configured (in Configuration > Basic site settings), requests to unknown (non-CE-API) pages get redirected to the frontend.
We want to prevent that.
Steps to reproduce
- Configure path in
page.404insystem.sitesettings (a.k.a. "Default 404 (not found) page" in admin/config/system/site-information) - Visit BACKEND-URL/nonexistent-page
- Be redirected to the frontend
Proposed resolution
... under discussion in the comments.
Remaining tasks
Decide on implementation.
Likely: take care of the "Default 403 (access denied) page" setting in an equivalent way.
User interface changes
Visiting BACKEND-URL/nonexistent-page will not (be redirected to and) display a neatly rendered page, anymore.
This is not usually a problem, because backend URLs aren't usually visited by people who should see neatly rendered pages.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | Screenshot 2024-04-15 at 09.36.47.png | 286.68 KB | roderik |
Issue fork lupus_decoupled-3442110
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
roderikA solution I was tinkering with (diff, no MR yet) cancels the redirection to the frontend, if the page is being rendered by CustomPageExceptionHtmlSubscriber (i.e. it's a subrequest with a 404 code). It then renders the standard 404 page in "whatever default backend view mode".
I personally don't like this as a general addition to this module. Because "whatever default backend view mode" is not necessarily configured to be non-ugly. So the 404 page may come out ugly and even may disclose some information that looks strange.
Example output for https://OUR-SITE'S-BACKEND-DOMAIN/nonexistent-page is attached to this issue as a screenshot, to show what I mean.
Alternative solution, which we should probably impement, is: add an extra class that
Comment #3
fago@roderik
Yes, that seems fine. We should not redirect any 4xx or 5xx errors and show them within Drupal.
Thus, I think the fix is good. But I'd suggest we also test-coverage for that to fix the behavior:
* 4xx / 5xx errors are shown within drupal
* Access frontend route like node/123 redirects to frontend
Not sure whether the seccond part is already covered.
Comment #4
fagoI cannot reproduce the described behavior. If it really happens, it certainly qualifies as bug, thus fixing the category. Please provide steps to reprodocue, e.g. with gitpod test environments.