skip to Main Content

SAP AppRouters in a Nutshell

Initially, while working on applications deployed in the SAP Cloud Foundry, I often came across the term AppRouter. As the name suggests, it’s an application router, but I still had many questions about it. What is an AppRouter? Where can I find it?  Why do I need an AppRouter? And, which kind do I use and when? Going through many blogs and working with AppRouters hands-on, I have developed a particular understanding of it. In my blog today, I will take you through my understanding of AppRouters.

So let’s dive in!

What is an SAP AppRouter anyway?

The AppRouter is a Node.js library used as a single entry point for an application running in the Cloud Foundry, SAP BTP. You must have read or heard of it; however, what does this mean?

Let’s say a user is trying to access an application by calling the URL; there are a few things that would happen:

  1. The request comes to the AppRouter of the application.
  2. The AppRouter checks if authentication is required (configured in xsapp.json of the application) and sends information like client location, cookies, and requested page details to the browser.
  3. If authentication is required, the AppRouter redirects to the SAP’s IDP Login page.
  4. Once the login is successful, the AppRouter redirects to the index.html of the application.

Further on from point no. 2 above, the authentication configuration is maintained in a file called xs-app.json. This file can carry other configurations as well, such as;

  1. Authentication 
  2. Authorization including scope check
  3. Logout process and redirection
  4. Session management of the AppRouter
  5. Destination to access the API with CSRF protection within the application
  6. Cache
  7. CORS configuration

Every Application has its AppRouter. We can either use the application’s AppRouter or set up an independent application router.

What are the Different Types of AppRouters?

Managed AppRouters are when we choose to use an application’s AppRouter, whereas Standalone AppRouters refer to situations where we may decide to set up our own.

Difference between Managed AppRouters and Standalone AppRouters

Standalone AppRouters and Managed AppRouters
Standalone AppRouters vs Managed AppRouters

When to use a Managed AppRouter and a Standalone AppRouter?

It is best practice to use a Managed AppRouter in most scenarios as it has inbuilt integration with most SAP business services. We can use a Standalone AppRouter when we want our application to work across tenants.


To learn more about similar topics, visit our blogs here.

Kritika Hebballi is a developer at Mindset Consulting and has 3.5 years of experience in creating responsive web applications using SAPUI5 and BTP services. She is passionate about user stories and solving user/ business problems using technology. Her guilty pleasure is storytelling, although she's still working on her own skills. In her free time, you can find her reading, sketching, or traveling(new found hobby) and she is a big foodie.

Back To Top