Umbraco-CMS
Umbraco-CMS copied to clipboard
Error404Collection not used when node exists but without template
Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9
9.4.1
Bug summary
We have a few archive nodes, which by default have generated URL's
When accessing these pages e.g. /products
we get the default 404 page.
However when we access a non-existing node like /test
is does show our custom 404 page.
"Error404Collection": [
{
"Culture": "en",
"ContentKey": "7b52eeef-883d-4483-8e59-d9442485bfa3"
}]
Specifics
No response
Steps to reproduce
Create a few nodes without templates and configure a custom 404 page via Error404Collection
in appsettings.json
Access a random non-existing page e.g. /test
- this should show the custom 404-page.
Access a node with a generated URL but without a template, e.g. /products
- this show the default 404-page.
It may be related to this issue https://github.com/umbraco/Umbraco-CMS/issues/12182 but the node hasn't been renamed or redirects been created.
Expected result / actual result
No response
Sounds like this is related to #12002?
@nathanwoulfe possible...
I checked on another project on v9.2.0 .. where it throws 500 internal server error instead.
Any updates on this? Or any workarounds as I'm using Umbraco without templates on all nodes (except root) so I'm a bit stuck.
My workaround is to create a content finder which wraps the existing content finders
public async Task<bool> TryFindContent(IPublishedRequestBuilder request)
{
if(await _finderByUrl.TryFindContent(request) || await _finderByIdPath.TryFindContent(request))
{
if (request.PublishedContent.TemplateId == null)
{
request.SetPublishedContent(null);
return false;
}
// other custom stuff here
if (TryRedirectToCanonical(request))
{
return true;
}
return true;
}
return false;
}
NB: still an issue in 10.0.1
Hey all, sorry for the late reply.
Checking this out in the latest V10, this issue seems to have been resolved, probably by https://github.com/umbraco/Umbraco-CMS/pull/12002, so I'll go ahead and close this as solved 😄