Skip to Content

Number of AppRouters per space

Hi all,

we are currently discussing the AppRouter setup when working with the HTML5 App Repo and favoring a central App router per Space that forwards the requests to the corresponding HTML5 app. The plan is that all apps in a space are somehow related (for example one space for logistics, finance etc.). Advantage would be to use less (expensive) runtime memory due to the smaller number of AppRouters.
Once a new app is deployed, you would then need to add a new route to central AppRouter in addition to the deployment of the HTML5 resources to the repo and the service & db module to CF. Are there any disadvantages why we should not follow this approach or what exactly is the best practice regarding the number of AppRouters per space?

Thanks a lot,

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jun 18 at 02:26 PM

    Hi, after some trial and error, we implemented a working central approuter. The approuter uses a cross mta nodejs service and a html5-app-repo for the SAPUI5 App. The approuter requires section looks like this:

    mta.yaml approuter:

        - name: html5-repo-runtime
        - name: appLibraryCAP-uaa
        - name: srv-binding
          group: destinations
            forwardAuthToken: true
            strictSSL: true
            name: appLibraryDestination
            url: ~{srv-url}

    The cross mta resource for the approuter can be referenced like this:

    mta.yaml approuter:

     - name: srv-binding
       type: configuration 
          provider-nid: mta 
          provider-id: CROSS_MTA_ID:srv-binding
          version: ">=1.0.0" 
            org: ${org}     
            space: ${space} 

    The service we are using needs to provide the srv-binding variable and it has to be public:

    mta.yaml appLibrary (cross mta)

     - name: appLibraryCAP-srv
       type: nodejs
       path: gen/srv
          ignore: ["node_modules/"]
         memory: 256M
         EXIT: 1  # required by deploy.js task to terminate 
        # Resources extracted from CAP configuration
        - name: appLibraryCAP-db-hdi-container
        - name: appLibraryCAP-uaa
        - name: srv-binding     
          public: true
            srv-url: ${default-url}

    You can access the node-js service and the html5 repos with the approuter by defining the routes in the xs-app.json file:

    xs-app.json approuter

    "routes": [{
        "source": "^/appLibraryCAP/(.*)$",
        "target": "$1",
        "service": "html5-apps-repo-rt"
        "source": "^/appLibraryDestination/(.*)$",
        "target": "$1",
        "authenticationType": "xsuaa",
        "destination": "appLibraryDestination",
        "csrfProtection": true
        "source": "^/cbscloudsdkappmysdkapp/(.*)$",
        "target": "$1",
        "service": "html5-apps-repo-rt"

    Now you can extend this approuter with every resource you want.

    One downsite:

    For proper JWT handling the xsuaa Service of the cross mta needs to be part of the approuter mta. So you also need the same xs-security.json file in both projects. This might cause some conflicts while deploying the .mtar files.

    Is there a way to consume a resource in a mta.yaml file without updating it during the deployment?

    We think a central approuter is using the full potentional of the HTML5 Repo and minimizes the amount of running applications in our space.

    Or does anybody see any major disadvantages in this concept?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 21 at 08:06 PM

    Hi Nico, Armin,

    I would like to propose a new approach using a new capability, provided by SAP Cloud Platform Portal Application:

    With this new capability, you don't have to manage your own approuter, and you don't have to worry about the application runtime consumption.

    With this option, the HTML5 Applications are fully managed by SAP Cloud Platform.

    All you need is to subscribe to Portal Application.

    You can learn more about it here.

    Best Regards,


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.