Skip to Content
Technical Articles

SAP Tech Bytes: FAQ Managed Approuter vs. Standalone Approuter

In the past two years, I wrote a few posts that explained the nature of the managed approuter and when it can be helpful to use this feature (here and here). In parallel, we created a GitHub repository that contains sample projects and diagrams to make the differences between both options more tangible. Overall, there’s a lot of content that explains why it makes sense to favor the managed over the standalone approuter. (I highly recommend that you make yourself familiar with the linked resources above if you don’t know them yet). Once you read the content, you have a good understanding of the managed approuter’s advantages. And with this, it makes sense that the managed option is the default setup for newly generated SAP Fiori apps in the SAP Business Application Studio.

But, naturally, many developers are new to SAP Business Application Studio and SAP BTP, which can cause confusion about the standalone approuter (as they only know the managed approuter). For those developers, I compiled this short FAQ to help them understand the differences when you come “from the other direction”:

Which%20option%20is%20the%20best%20to%20choose%3F

How to pick the right option?

Q1: Is the managed approuter a service in SAP BTP?

No, the managed approuter is not a service. It is a feature of various SaaS subscriptions that SAP provides in SAP BTP. Both the SAP Launchpad service and the SAP Cloud Portal service come with that feature. This is why you don’t find the managed approuter in the Discovery Center.

Q2: Why don’t I see my app in the Cloud Foundry space?

A: Cloud Foundry spaces only contain applications that consume runtime memory. HTML5 applications won’t show up here as they are a set of static content files (.html, .js, .css) that are run by the browser. In SAP BTP, HTML5 Applications are stored in HTML5 Application Repository service. During runtime, HTML5 Application files are served to the browser by the managed or standalone approuter.

If you have a standalone approuter, you will see it in the space, unlike the HTML5 Applications hosted in HTML5 Application Repository. These applications can be visualized using HTML5 Applications UI (in the SAP BTP Cockpit) or via cf html5-list.

Q3: I used the default option (managed approuter) when I created the SAP Fiori app, and I could deploy it. But now I get the following error “Error No client with requested id”. (or here)

A: This most likely means you didn’t subscribe to the correct subscription service. As mentioned above, here are two services: The SAP Launchpad Service and the SAP Cloud Portal service, both of which should work for what you want to do. Make sure you are subscribed to these subscriptions. Depending on your account, you might also see service instances with these names. Please don’t use service instances for this; they won’t help you here!

The URL of the managed approuter contains either cpp (pointing to the SAP Cloud Portal service) or launchpad(pointing to the SAP Launchpad service). Both segments are substitutable, but you need to verify to use the segment of your enabled subscription. 

Q4: Can I change the URL of the managed approuter?

A: Th default URL is determined by the subscription service and your subaccount subdomain. But you can change the URL in production accounts via the custom domain service. 

Q5: When using the managed approuter, should I use subaccount- or instance-level destinations?

A: Instance-level destinations should be used from now on forward as they avoid subaccount-wide access and enable better mta lifecycle handling. Note that when undeploying with instance-level destination, the destination configurations get deleted as well, unlike subaccounts destinations.

Q6: I neither want to use the SAP Launchpad Service nor the SAP Cloud Portal service. Can I use the managed approuter anyway?

A: You can subscribe to these products just to get managed approuter functionality (no need to model launchpad tiles, etc.); just run the applications from HTML5 Application UI. If you do not want to use Launchpad/Portal because of the cost, consider the cost (application runtime, maintenance, upgrades) of a standalone approuter. We recommend using a standalone approuter only if you need to implement approuter extensibility for some special use cases.

Q7: How can I build an SAP Fiori app that leverages the standalone approuter?

A: The SAP Business Application Studio offers a shortcut for the default option that uses the managed approuter. Look at this video which explains the longer flow (create empty MTA, add managed approuter, add Fiori app). Follow this flow but select the “standalone” approuter when prompted. I also added a few screenshots below that you can follow to see all the needed steps.

Q8: Can I change the URL of the standalone approuter?

A: Yes. The default URL can be customized via the “host” property of the mta.yaml file. The *.cfapps.eu10.hana.ondemand.com-suffix is usually given, but you can change this as well with a custom domain

 

Attachment to question 7:

Create%20an%20empty%20MTA%20project

Create an empty MTA project.

Create%20a%20module%20from%20template

Create a module from template.

Select%20Approuter%20Configuration

Select “Approuter Configuration”.

Make%20sure%20to%20answer%20these%20questions%20with%20yes

Make sure to answer these questions with a yes.

Add%20any%20web%20app%20and%20in%20the%20last%20step%20of%20the%20wizard%20make%20sure%20to%20include%20it%20in%20the%20MTA%20project%20and%20the%20add%20the%20deployment%20configuration

Add any web app and in the last step of the wizard, make sure to include it in the MTA project and add the deployment configuration.

Theres%20currently%20a%20glitch%20in%20the%20wizard.%20Please%20add%20the%20highlighted%20lines%20manually%20to%20fix%20the%20project%20manifest

There’s currently a glitch in the wizard. Please add the highlighted lines manually to fix the project manifest.

Now you are ready to build and deploy the project with the standalone approuter.

36 Comments
You must be Logged on to comment or reply to a post.
  • Hi Marius,

    You have mentioned the recommendation of "using a standalone approuter only if you need to implement approuter extensibility for some special use cases."  Do you have any further advice or clarification on approuter choice in the case of multi-tenant web app development?

    Thanks,

    Mustafa.

    • Hi Mustafa,

      Good point! As of now, I'd say that multi-tenancy requirements are also a legit use case for a standalone approuter.

  • Hello Marius,

    Can we still configure the managed approuter with environmental variables, for example to send custom headers?

    https://www.npmjs.com/package/@sap/approuter#additional-headers-configuration

    Best regards,

    Manuel

    • Hi Manuel,

      yes and no. It is not possible to change the environment variables for the managed approuter BUT you can make use of all properties of the xs-app.json configuration file:

      responseHeaders property

      With the custom response header property, you can add headers, which the application router returns to the client in its responses.
      The property is an array of objects, each object having the following properties:

      Property Type Optional Description
      name String response header name
      value String response header value

      Example:

      { "responseHeaders" : [
          {"name": "header1", "value": "value1"},
          {"name": "header2", "value": "value2"}
        ]
      }
  •  

    Hello Marius,

    The blog was very useful and informative related to Application router Feature in BAS (IDE).

    I had created an MTA Project , the project structure is

    and then Deployed the Application to CF Space. while logging in to CF in terminal through Commands.

    I am able to get Application URL but unable to open the App when opened the URL showing "Not Found".

     

     

    The App is working fine Business Application Studio but after deploying the Standalone App to CF Space the application is getting Visible in my Dev Space but when clicking on the generated URL it is showing the Not Found Error.

    Could you please help me out with this issue.

    Thanks in Advance.

    Regards,

    Mamatha M

    • Hi Mamatha,

      It seems like a route points to a target but the approuter cannot find anything there. This could either mean the route points to the wrong target or that the target is right but empty.

      Here are a few questions that might guide you to the solution:

      Where does this route point to?

      Is there something at the target (either in the local directory or in the HTML5 app repo)?

      Does the log of the approuter provide any additional information?

      • Here there is no target i.e.., no destinations I have taken a sample App with static Data, created app with standalone appRouter and deployed it to Cloud Foundry Space there after deployment I can get the App is started and App URL but when I am opened it is getting either "Not found" or "Internal server error" .

        I tried with managed approuter, deployed the app to CF space, app getting started  but still same I am getting like shown below

        I have sample Static data in my application which runs fine in BAS but when I deploy the same app and after clicking on the generated URL it is showing error.

        please let me know where I am getting wrong do we need to add any piece of code in package.json, xs-app.json, ui5.yaml files to get the app to be displayed. In Xs-app.json file given

        "welcomeFile": "index.html" .
        Regards,
        Mamatha M

         

        /
        • So you added your web app manually and did not follow the wizard to add it, right?

          This would explain why the connection between the approuter and the HTML5 application repository isn't working.

          Can you execute "cf html5-list" from the terminal to see whether the web app has been uploaded to the HTML5 application repo?

          The next step, would then be to change the xs-app of the standalone approuter to point to this web app like shown here.

          • No I didn't add webapp Manually I followed the wizard process only while creating the Application. If I execute the "cf html5-list" the application is successfully uploaded to HTML Application repo. But I am unable to get the Application Displayed and I tried with taking destination while connecting to Odata Service if I tried to deploy in CF Space it is showing

            "For application 'Demo': Routes cannot be mapped to destinations in different spaces"

            in terminal while I try to push the App to CF.

             

             

          • I would assume that something is wrong with your destination. Can you confirm that the destination that you referenced in the xsapp exists in your target space?

          • No Actually I didn't taken any Destination at first I have taken sample UI5 App without any Destination only with static Data to load UI. Later I tried with Northwind.

            With Destination xs-app file code

            but still same problem persists.

            WIthout Destination xs-app.json file

            Now needed without destination just UI to load in the App. Have deployed the app to CF Space, the generated URL is not getting opened showing some errors like follows:

            "Not Found", "Internal Server error" or "Requested route does not exists"

            Either By taking MTA or Freestyle SAP UI5 Template getting same issue, URL is not getting opened.

            Suggest me where I goes wrong.

            Thanks in Advance

             

          • You use destinations in both cases. The upper file uses a "northwind" destination and the lower one uses a "ui5" destination.

            If you use any type of destination, you need to (a) create a destination service instance, (b) bind it, and (c) add the destination configuration (this tutorial might help you).

          • if we use the UI5 as destination we wont take any service right so we couldn't bind anything. what is the use of creating the destination service instance, after creating the Destination service instance, what is the next process.

            I followed the same what was given in tutorial. I am able to access the Entitysets and able to bind. But after deploying the App to CF. The Application generated Routes URL doesn't work. This is the main issue I am facing.

          • I think you might have missed a step in the wizard or in the instructions. I can confirm that the scenario works as I described it above.

            Please mind the captions of the screenshots above.

    • Hi Mamatha, same happened to me, you need to check the file xs-app.json inside the approuter directory and be sure there is a destination, I had to add it manually, try something like this:

      {
        "authenticationMethod": "route",
        "routes": [
          {
            "source": "(.*)",
            "target": "$1",
            "destination": "your-destination"
          }
        ]
      }

      Hope it helps.

      ara

      • Hi Ara,

        Thanks for quick reply, Actually I don't have any destination as I am doing without destination static data but I will try now adding destination and will let you know.

        Thank you

        Mamatha

    • Hi Arjun,

      are you asking for a "wizard" option to change the selection that has been made previously? The answer to this question would be no, it's not possible.

      But you can remove the files of the standalone approuter and then add a managed approuter manually (and vice-versa). That works.

      • Hi Marius,

        Thanks for your response.

        Incase I want to change approuter configuration from Managed to Standalone, which files should I be deleting, as I don't see any files related to approuter in case of managed. Please advise.

        Regards,

        Arjun

        • In this case you need to remove some lines of the mta.yaml. You can find a list of the respective lines in this post (in section 'Make your web apps “serverless”')

  • Hi Marius,

    Thank you for the blog post and the valuable information about the Managed App router!

    Could you please tell a bit about the support of the Managed App Router for Single Sign-On scenarios?

    Thanks a lot in advance!

    • Hi Edgar,

      SSO is not a feature of the approuter per se (that depends on the IdP), so it doesn't differentiate from the standalone approuter.

  • Hi Marius,

    We have a development scenario where we have a SAP Cloud Freestyle Portal with Ui5 applications in the Cloud Foundry Environment.

    As per functionality we have to use Assertion attributes passed by Custom IDP in the ui5 applications. We have achieved this by using Standalone Approuter with User Api service and Jwt decode.

    https://www.npmjs.com/package/@sap/approuter#user-api-service

    https://blogs.sap.com/2020/07/24/mapping-of-saml-attributes-with-xsuaa-jwt-in-cloud-foundry/

    The issue with this approach is that this is causing issues at Portal level with Custom Themes and Cross- Navigation between apps as the ui5 apps have to be deployed as Iframe objects with Dynamic URL configuration on the Portal.

    We did not use Managed approuter approach as the Ui5 app did not have access to the approuter which resulted in us not getting access to assertion attributes.

    Is there a way to get assertion attributes at app level using Managed Approuter?

    Regards,
    Kaustubh

    • That's a good question. But I need to confess that I'm totally blank on this topic. I did ask a colleague and this is the response that I got:

      Last week another customer asked the same.

      My recommendation is to add an additional (e.g.: /user/assertions) endpoint in their backend application that is accessed via a destination with property HTML5.ForwardAuthToken = true. This endpoint would decode the forwarded token and return the assertions. Then their html5 application can call the /user/assertions endpoint via an xs-app.json route.

       

      I hope this helps (as this is the only answer I can provide). But it'd be great if anyone else from the community could jump in here.

  • Hello Marius,

    Is it possible to let Managed Approuter be the router(or proxy server) for micro-services deployed in BTP CF(like the services developed with CAP)?

    Thanks & Best Regards,

    Donny

    • Nice idea 🙂
      Yes, that should be possible! But you need to have a (dummy) web app that contains a xs-app.json file and this file needs to reference destinations that point to your microservices.

  • Hello Marius,

    first time a nice blog and thanks for sharing!!

    I have the following problem, I use the SAP-Approuter and my request to the backend is greater than 30 seconds, normally these settings are set in the destinations for the Approuter, but since this does not exist, I currently can not find a setting how I can override the attribute "timeout". Do you know a way to do this?

    Thanks & Best Regards

     

    • Hi Niklas,

      thanks.

      Have you tried to use the destination property "timeout" (mentioned in section "environment destinations")? I haven't used this particular one but I would assume that it does the job.

      If that doesn't help, you might fall in the "customization" category where you need to use the standalone approuter.

      • Hello Marius,

        thank you for your Help.

        I have solved my problem by adding the "timeout" in the mta.yaml in the subsection of my cap-service.

        Best Regards

         

    • You usually don't run the standalone approuter in the SAP Business Application Studio but you use the Fiori Tools that start a development server that exposes the static content. The appserver is usually only run when the project is deployed.

       

      That doesn't mean you cannot run the approuter as well. But in this case, you need to take care of mapping the right values in the default-env.json.