Closed vkuybida closed 1 year ago
@vkuybida I am running into the same issue. I have just noticed that when using Error404Collection, even though this functionality does work and the custom page shows, it is actually setting the status code to 200, not 404 like the default one does.
I have feeling this is what is causing the redirects to not work, as obviously if there was a successful 200 response, skybrud would just ignore (as expected).
I am just looking into why Error404Collection sets a 200 response at my end right now, if i find anything I will post here and let you know.
thanks.
at this point, as workaround, I implemented custom ContentLastChanceFinder where handle Skybrud redirects and 404 errors. It works fine.
Task
#region Resolve Skybrud redirects
// Skybrud redirects
if (_redirectsService.GetRedirectByUri(request.Uri) != null)
{
return Task.FromResult(false);
}
#endregion
#region Resolve 404 page
.....
var notFoundPage = siteRoot.Children.FirstOrDefault(x => x.Name == "404");
if (notFoundPage != null)
{
request.SetIs404();
request.SetPublishedContent(notFoundPage);
return Task.FromResult(true);
}
#endregion
return Task.FromResult(false);
}
This is an issue with Umbraco, as it accidentally sets a 200 OK status code. It should be fixed in 11.3, which was out earlier today:
This is an issue with Umbraco, as it accidentally sets a 200 OK status code. It should be fixed in 11.3, which was out earlier today:
great to hear, thanks for the info
This is an issue with Umbraco, as it accidentally sets a 200 OK status code. It should be fixed in 11.3, which was out earlier today:
Awesome thanks @abjerner - yes I've just confirmed upgrading to Umbraco 11.3 now correctly sets a 404 when using Error404Collection, meaning Skybrud now works as expected. Thanks for your help and the great package. 👍
Which version of Skybrud Redirects are you using? (Please write the exact version, example: 4.0.8)
4.0.8
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
11.2.2
Bug description
Skybrud Redirects does not redirect when Error404Collection is set up. It shows 404 error. Without 404 redirects it works fine.