SAP Spartacus页面fake Url的防御机制 - not found页面的显示逻辑

SAP Spartacus里的路由机制共同有4种:
When Spartacus is launched, the route is handled by the router logic. There are 4 different types of routing that will be evaluated:

(1) the route should be handled by a custom router path; the customer has added hard-coded routes, and we should prioritise those.
(2) the route is either a PLP or PDP
(3) the route is a CMS content page
(4) the route is unknown (404 not found)

When an incorrect URL is passed to Spartacus, it will likely end up in the 3rd type. Spartacus will use the CMS api to fetch the content page for the given URL.

如果一个并不存在的url传递给Spartacus,会被当成content page处理,Spartacus会使用CMS API去读取该url对应的content page.

If the CMS cannot find a matching content page, it will respond with a 404 error. Spartacus will handle this 404 error, and redirect the user (under the hood) to the not found CMS page.

如果CMS返回404错误,Spartacus会显示CMS里model的not found CMS页面。

结果:显示not found页面


navigation start:
app.module.ts:115 Jerry: NavigationStart(id: 1, url: ‘powertools-spa/en/USD/jerry’)


Jerry: RoutesRecognized(id: 1, url: ‘powertools-spa/en/USD/jerry’, urlAfterRedirects: ‘powertools-spa/en/USD/jerry’, state: Route(url:’’, path:’’) { Route(url:‘jerry’, path:’**’) } )


Jerry: GuardsCheckStart(id: 1, url: ‘powertools-spa/en/USD/jerry’, urlAfterRedirects: ‘powertools-spa/en/USD/jerry’, state: Route(url:’’, path:’’) { Route(url:‘jerry’, path:’**’) } )


Jerry: ChildActivationStart(path: ‘’)

app.module.ts:115 Jerry: ActivationStart(path: ‘**’)


id为jerry的content page不存在,但是not-found content page存在:


汪子熙 CSDN认证博客专家 前端框架 Node.js SAP
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 博客之星2020 设计师:CY__ 返回首页