A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Routing not working after upgrade

Vote:
 

I have upgraded Optimizely 11 -> 12 and Commerce 13 -> 14.

I now have trouble getting the routes to work.

/[catalog]/[category]/[product] simply does not work. It returns a 404 page.

Previewing in /episerver/commerce works fine.
Routing for Optimizely works fine.

I have:
- services.AddCommerce()
- endpoints.MapContent()

Added web site to catalog.

The documentation seems outdeted?
https://docs.developers.optimizely.com/commerce-connect/docs/routing

Do I need to do anything to make the routing work?

#341457
Edited, Jan 19, 2026 18:06
Eric Herlitz - Jan 19, 2026 22:53
Quite hard to tell what's not working without you posting your entire bootstrapping
Andreas Bergqvist - Jan 20, 2026 11:16
I understand, It's a complex web site. And I will try to clean up a bit to be able to see if I find anything causing the problems.
And maybe be able to explain what I do.

But, generally:
- services.AddCommerce()
- endpoints.MapContent()

Should be enough to register Commerce catalog routing?

The linked documentation, is that for previous (.NET Framework) versions?
Or is there a "register routes" step I might be missing?
Vote:
 

Hi Andreas,

You need to register the partial router for the catalog, like metioned in docs (although a bit outdated):

 

using EPiServer.Commerce.Initialization;
using EPiServer.Commerce.Routing;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;

namespace Your.Project.Namespace;

[ModuleDependency(typeof(InitializationModule))]
public class RegisterRoutingModule : IInitializableModule
{
    public void Initialize(InitializationEngine context)
    {
        CatalogRouteHelper.MapDefaultHierarchialRouter(false);
    }

    public void Uninitialize(InitializationEngine context)
    {

    }
}
#341466
Jan 21, 2026 10:20
Andreas Bergqvist - Jan 23, 2026 10:37
That did help a bit, thanks!

I still have problems with routing to products...

With that code you wrote I can now:

- Goto /[language]/[catalog]/[category]
- I can click "Preview" in Commerce admin on a Category and use "On-Page Editing".

But, for products, I get no "Preview" and "On-Page Editing" does not work (just still shows form).
If I go to an URL /[language]/[catalog]/[category]/[product] i get an 404.

I understand that it might be hard to help, without access to the code.
What I'm looking for is general directions when it comes to upgrading to Commerce 14 (and Optimizely 12 / .NET 8 - from .NET Framework).

Another thing I noticed is that when trying to get the correct URL to a Commerce item, I need to get UrlResolver from HttpContext.
It seems like the code can't figure out the correct URL (only to Commerce items) without being in a http context, is that correct?
Karol Berezicki - Jan 25, 2026 13:36
Hi Andreas,
The problem with routing to a product sound like an issue with view template resolving, and without it the UrlResolver will not be able to generate Url.
It's hard to tell without access to whole solution, but maybe this at least will give you a hint where to look :)
Andreas Bergqvist - Jan 27, 2026 10:21
Thanks, your pointers got me on the right path.
Not sure why it previously worked (we did not initially develop the old site).
I thought controllers that pointed to the correct view was enough.
* 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.