cancel
Showing results for 
Search instead for 
Did you mean: 

Is xs-app routing needed for UI5 application cache buster? (CF Application Runtime / HTML5 Repo)

pieterjanssens
Active Participant
0 Kudos

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"
    }

Accepted Solutions (1)

Accepted Solutions (1)

pieterjanssens
Active Participant
0 Kudos

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

Answers (1)

Answers (1)

hschaefer123
Participant

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

pieterjanssens
Active Participant

Hi Hogler,

This is helpful, thanks!

  • I didn't know it was only working for the default handler when using html5-apps-repo
  • I will definitely add the cacheControl setting for index.html to my approuter config!

Best regards,

Pieter