on 09-12-2021 2:30 PM
Once application cache busting is enabled and the sap-ui-cachebuster-info.json is available, UI5 will start looking in the timestamped directory for the resource.
E.g. /webapp/~1623054905000~/controller/App.controller.js
Is it up to us to provide a routing to these original files in both deployment to a standalone app in the Cloud Foundry Application Runtime and the HTML5 Application Repository?
At the moment I am achieving this via specific routing in the Approuter, but it's because I don't find any specific documentation, that I'm not sure this is the intended way.
{
"source": "^/webapp(?:/~\\d+~)?/(.*)$",
"authenticationType": "xsuaa",
"target": "$1",
"localDir": "dist"
}
I've tested both scenario's:
- UI5 app hosted on HTML5 Application Repository: taken care of by the service
- UI5 app served by its own @sap/approuter: doesn't work out of the box, requires routing as shown above
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pieter,
my current foundings are, that @sap/approuter will handle this ONLY automatically, if you call your app using the html5-apps-repo-rt endpoint.
Means, if you have the default handler at the end of your xs-app.json like
{
"source": "^(/.*)",
"target": "$1",
"service": "html5-apps-repo-rt",
"authenticationType": "none"
}
this should work automatically for you (also on central app router).
But the, you have to call your route with the name as identified by the ui5 manifest.json
"sap.app": { "id": "my.domain.app"...}
in this case /mydomainapp/... (without the dot ".").
If you have added a custom route, this will not work and you have to handle the cachebuster by yourself.
The index.html MUST/SHOULD NOT be cached also to allow updates!
{
"source": "^/shop/index.html(.*)$",
"target": "/mydomainapp/index.html$1",
"service": "html5-apps-repo-rt",
"cacheControl": "no-cache, no-store, must-revalidate"
}, {
"source": "^/shop/sap-ui-cachebuster-info.json(.*)$",
"target": "/mydomainapp/sap-ui-cachebuster-info.json$1",
"service": "html5-apps-repo-rt",
"cacheControl": "no-cache, no-store, must-revalidate"
},
{
"source": "^/shop/~(.*)~/(.*)$",
"target": "/mydomainapp/$2",
"service": "html5-apps-repo-rt",
},
{
"source": "^/shop/(.*)$",
"target": "/mydomainapp/$1",
"service": "html5-apps-repo-rt"
}
and finally the generic handler pushinbg all requests to html5 repo (see above)
Maybe, this info is also helpful for you.
The above solution is working for us in productive scenarios.
Best Regards
Holger
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hogler,
This is helpful, thanks!
Best regards,
Pieter
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.