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?
* 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.