Try our conversational search powered by Generative AI!

Custom rewrite clashes with geta not found handler, Sitemap addons and stops working of handlers

Vote:
 

Hello,

We have custom redirect rules applied using rewriter options and calling it from Startup -> Configure() method using app.UseRewriter(RewriteOptionsHelper.rewriteOptions);
But this stops the buttons of add-on of Geta from working as it might be clashing with it.
We tried to use INotFoundHandler interface to provide custom rules but that's stops edit section of CMS 12 to load and gives scripts error in console.
Can you please guide and help us to resolve the issue.

Thanks,

Deepa

#306869
Aug 16, 2023 7:47
Vote:
 

Not sure if this will help your issues, but order tends to matter with middleware. I've found for rewrite to work correctly it needed to be before status code rewrites if you use those and before Geta Not Found Handler. Here's what I've used in configure:

            using (var stream = File.OpenText("RewriteRules.config")) {
                var options = new RewriteOptions()
                    .AddIISUrlRewrite(stream);
                app.UseRewriter(options);
            }

            app.UseStatusCodePagesWithReExecute("/error/{0}");
            app.UseNotFoundHandler();
            app.UseOptimizelyNotFoundHandler();
#307220
Aug 21, 2023 18:32
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.