[英]SAP BTP Portal - App react Not found after refresh(F5)
在 SAP BTP 門戶或 Launchapd 服務中使用 ReactJS 運行 HTML5 應用程序。 但是,當重新加載頁面或將外部鏈接用於應用程序的內部路由時,它最終會給出錯誤 404。在我看來,approuter 還沒有為此做好准備。 外部鏈接如何工作並導致應用程序的內部路由?
xs-app.json
{
"welcomeFile": "index.html",
"authenticationMethod": "route",
"logout": {
"logoutEndpoint": "/do/logout",
"logoutPage": "/logout-page.html"
},
"routes": [
{
"source": "^/user-api(.*)",
"target": "$1",
"service": "sap-approuter-userapi"
},
{
"source": "/api/(.*)$",
"target": "/api/$1",
"authenticationType": "xsuaa",
"destination": "target-mngt-api",
"scope": ["$XSAPPNAME.PartnerSales"],
"csrfProtection": false
},
{
"source": "/sap/(.*)$",
"target": "/sap/$1",
"authenticationType": "xsuaa",
"destination": "S4",
"csrfProtection": false
},
{
"source": "^/logout-page.html$",
"service": "html5-apps-repo-rt",
"authenticationType": "none"
},
{
"source": "^(.*)$",
"target": "$1",
"service": "html5-apps-repo-rt",
"authenticationType": "xsuaa"
},
{
"source": "^index.html$",
"service": "html5-apps-repo-rt",
"authenticationType": "xsuaa",
"cacheControl": "no-cache, no-store, must-revalidate"
}
]
}
在構建 React 應用程序之后。 在 public 文件夾中創建一個名為 Staticfile 的新文件,並將以下內容放入其中。 推送狀態:已啟用
然后將應用程序部署到 cloudfoundry BTP。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.