Umbraco-CMS icon indicating copy to clipboard operation
Umbraco-CMS copied to clipboard

Custom 404 not routing on a non cultured URL

Open OwainJ opened this issue 10 months ago • 3 comments

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

13.2.2

Bug summary

My site has 2 cultures, and I have setup my Error404Collection like so:

"Error404Collection": [
     {
          "Culture": "default",
          "ContentXPath": "$site/errorPage[@nodeName='Page not found']"
     },
     {
          "Culture": "cy-GB",
          "ContentXPath": "$site/errorPage[@nodeName='Tudalen heb ei darganfod']"
     }
]

English is set as the default language: image

And the cultures are setup as one level paths on the homepage node: image

These are results when testing the 404 page: https://localhost:44310/en/not-a-real-page - Correctly routes to the custom English 404 page https://localhost:44310/cy/not-a-real-page - Correctly routes to the custom Welsh 404 page https://localhost:44310/not-a-real-page - Routes to the default Umbraco 404 page

Specifics

No response

Steps to reproduce

  • Setup a site with 2 cultures
  • Set the 2 cultures as one-level paths on your root node
  • Add an custom 404 error page that varies by culture
  • Add the 404 Collection to app settings
  • Try triggering a 404 with cultured URLs and a non culture URL

Expected result / actual result

I would expect a URL without a culture https://localhost:44310/not-a-real-page to route to the custom 404 that has been set as 404 for the default culture, instead of the the default Umbraco 404 page, in the same way that any URL without a culture uses the default variant of a node.

OwainJ avatar Apr 17 '24 11:04 OwainJ

Hi there @OwainJ!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

github-actions[bot] avatar Apr 17 '24 11:04 github-actions[bot]

Hi there @OwainJ 👋

Thanks for reaching out! I can indeed reproduce this 🙂 It seems like we get an XPathException from publishedContentQuery.ContentSingleAtXPath(xpathResult) (link), which results in logging the error and returning null. This explains why we get the default Umbraco 404 page.

The behaviour is as you expect when we use Umbraco::CMS::Content::Error404Collection::ContentKey instead of ContentXPath.

I will mark this as up for grabs in case anyone wants to give it a go. 🚀

elit0451 avatar Apr 18 '24 12:04 elit0451

Hi @OwainJ,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post.

Thanks muchly, from your friendly Umbraco GitHub bot :-)

github-actions[bot] avatar Apr 18 '24 12:04 github-actions[bot]