In SAP BTP, modern cloud applications rarely consist of a single executable. A typical enterprise extension comprises an SAP Fiori Elements frontend, an application router reverse proxy, an XSUAA identity service instance, a Destination service instance, and optional microservices (CAP Node.js / Java).
The Multi-Target Application (MTA) specification provides a declarative framework (mta.yaml) that orchestrates the build order, dependency resolution, and atomic deployment of all heterogeneous components into SAP BTP Cloud Foundry.
The Application Router (Approuter) serves as the single entry point for all web traffic, orchestrating authentication with XSUAA, CSRF token handling, and URL reverse-proxying. In modern architectures, architects choose between two deployment models:
| Evaluation Vector | Managed Approuter (SAP Build Work Zone) | Standalone Approuter (Custom CF App) |
|---|---|---|
| Hosting Infrastructure | Fully managed serverless service by SAP | Dedicated Node.js container on Cloud Foundry |
| Compute Cost | Zero CF memory quota consumed | Consumes 256MB–512MB CF RAM per instance |
| Maintenance | Automatic zero-downtime security patches | Customer manages npm dependencies & security CVEs |
| Custom Logic | Not supported (configuration via xs-app.json only) |
Supported via custom Node.js middleware extension |
| SAP Recommendation | Standard Recommendation (Clean Core) | Specialized use-cases only (custom session headers) |
xs-app.json
Every route in xs-app.json must be configured with precision to avoid security leaks or cross-site request forgery vulnerabilities:
{
"welcomeFile": "/index.html",
"authenticationMethod": "route",
"routes": [
{
"source": "^/sap/opu/odata/(.*)$",
"target": "/sap/opu/odata/$1",
"destination": "S4HANA_CLEAN_CORE",
"authenticationType": "xsuaa",
"csrfProtection": true
},
{
"source": "^(.*)$",
"target": "$1",
"service": "html5-apps-repo-rt",
"authenticationType": "xsuaa"
}
]
}
For all non-GET HTTP requests (POST, PUT, DELETE) routed to SAP S/4HANA via the Destination service, csrfProtection: true instructs Approuter to automatically execute a HEAD / x-csrf-token: fetch handshake before forwarding mutating payloads.
xs-security.json
The XSUAA descriptor declares the identity perimeter of the application. In multi-tenant SaaS or dedicated enterprise deployments, scopes must follow the $XSAPPNAME.<scope> naming convention to prevent cross-app privilege escalation:
{
"xsappname": "com.corp.order.extension",
"tenant-mode": "dedicated",
"description": "Security profile for Clean Core extension",
"scopes": [
{
"name": "$XSAPPNAME.Admin",
"description": "Administrative privileges in extension"
}
],
"role-templates": [
{
"name": "AdminRole",
"description": "Grants Admin authorizations",
"scope-references": [
"$XSAPPNAME.Admin"
]
}
]
}
Production deployments must be executed through automated CI/CD runners (GitLab CI, GitHub Actions) using the official Cloud MTA Build Tool (mbt) and Cloud Foundry Deploy plugin (cf deploy):
# 1. Assemble artifacts into a deployable MTAR archive
mbt build -t ./mta_archives --mtar com.corp.order.extension.mtar
# 2. Deploy atomically to Cloud Foundry space
cf deploy ./mta_archives/com.corp.order.extension.mtar --delete-services --force
xs-app.json or UI code. Always resolve destinations dynamically through the Destination service.csrfProtection: false on mutating routes bypasses S/4HANA ICF gateway security, causing 403 Forbidden errors or opening CSRF vulnerabilities.
Generate validated mta.yaml, xs-app.json, and xs-security.json configs with our interactive tool.