Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skybrud Redirects does not redirect when Error404Collection is set up #169

Closed
vkuybida opened this issue Apr 12, 2023 · 5 comments
Closed
Labels
type/bug Something isn't working umbraco/v11 Issues and tasks related to Umbraco 11.

Comments

@vkuybida
Copy link

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.

@vkuybida vkuybida added the type/bug Something isn't working label Apr 12, 2023
@GC-JamesShelley
Copy link

@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.

@vkuybida
Copy link
Author

thanks.

at this point, as workaround, I implemented custom ContentLastChanceFinder where handle Skybrud redirects and 404 errors. It works fine.

Task IContentFinder.TryFindContent(IPublishedRequestBuilder request)
{
.....

#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);

}

@abjerner
Copy link
Member

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:

umbraco/Umbraco-CMS#13907

@abjerner abjerner closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2023
@abjerner abjerner added the umbraco/v11 Issues and tasks related to Umbraco 11. label Apr 13, 2023
@vkuybida
Copy link
Author

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:

umbraco/Umbraco-CMS#13907

great to hear, thanks for the info

@GC-JamesShelley
Copy link

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:

umbraco/Umbraco-CMS#13907

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. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working umbraco/v11 Issues and tasks related to Umbraco 11.
Projects
None yet
Development

No branches or pull requests

3 participants