Registry / http-networking / ui5-middleware-route-proxy

ui5-middleware-route-proxy

JSON →
library1.0.10jsnpmunverified

A middleware for the SAP UI5 tooling's ui5-server that enables route-based proxying of HTTP requests to backend servers. Version 1.0.10 is the current stable release, with automated publishes via GitHub Actions. It supports flexible configuration via ui5.yaml, including authentication (basic auth or custom Authorization header), path replacement, and changeOrigin option from http-proxy. It integrates with .env files for secrets, and is commonly used in UI5 development to proxy OData or other backend services. Compared to alternatives like ui5-middleware-simpleproxy, it offers per-route configuration and auth header customization.

npm install ui5-middleware-route-proxy
INSTALL
IMPORT
SIG · UI5-MIDDLEWARE-ROU
U
ui5-middleware-route-proxy
http-networkingjavascriptv1.0.10
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ui5-middleware-route-proxy
No JavaScript import; configured in ui5.yaml under server.customMiddleware
const proxy = require('ui5-middleware-route-proxy'); // not used directly in code
The package is used as a UI5 tooling middleware, not imported in application code. It is listed in package.json under ui5.dependencies and configured in ui5.yaml.

Shows minimal configuration to proxy /sap requests to a backend with authentication and path replacement.

// .env file PROXY_TARGET=https://mybackend.example.com PROXY_USERNAME=myuser PROXY_PASSWORD=mypassword // ui5.yaml server: customMiddleware: - name: ui5-middleware-route-proxy afterMiddleware: compression configuration: debug: true /sap: target: PROXY_TARGET auth: user: PROXY_USERNAME pass: PROXY_PASSWORD replacePath: true changeOrigin: true // package.json (devDependencies) { "devDependencies": { "ui5-middleware-route-proxy": "*" }, "ui5": { "dependencies": [ "ui5-middleware-route-proxy" ] } } // Install dependencies npm install --save-dev ui5-middleware-route-proxy dotenv // Start UI5 server ui5 serve --config ui5.yaml
Debug
Known issues
gotchaPackage must be listed in both devDependencies and ui5.dependencies in package.json, otherwise UI5 tooling will not load it.
fix
Add the package to 'ui5.dependencies' array in package.json, and also include it in 'devDependencies'.
affects: >=1.0.0
gotchaThe 'afterMiddleware' property must be set correctly to avoid middleware execution order issues. Typically 'compression' is used, but if compression middleware is not present, the server may fail.
fix
Ensure 'compression' middleware is enabled in your UI5 project, or adjust 'afterMiddleware' to an existing middleware like 'serveIndex'.
affects: >=1.0.0
gotchaIf the auth object contains a 'header' property, 'user' and 'pass' are ignored. Misconfiguration leads to unexpected authentication behavior.
fix
Either use 'header' or 'user'/'pass', not both in the same path configuration. If using 'header', ensure it's a valid Authorization header value.
affects: >=1.0.0
gotchaThe route key (e.g., '/sap') must include a leading slash. Omitting it will cause the route to not match.
fix
Always start the route key with '/' (e.g., '/sap', '/odata').
affects: >=1.0.0
gotchaWhen using .env variables, the variable name must be exactly as in .env file. Any mismatch results in the literal string being used.
fix
Double-check .env variable names and ensure they match the values in ui5.yaml. Enclose in quotes if necessary.
affects: >=1.0.0
deprecatedThe 'replacePath' option when set to true removes the route prefix from the forwarded path. This behavior may change in future versions.
fix
Explicitly set 'replacePath' to a string path if you need custom replacement, or set to true for current behavior.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'ui5-middleware-route-proxy'
Package not installed or not listed in ui5.dependencies in package.json.
fix
Run 'npm install --save-dev ui5-middleware-route-proxy' and add the package to 'ui5.dependencies' array in package.json.
ENOENT: no such file or directory, open '.env'
Missing .env file in project root, or dotenv not installed.
fix
Create a .env file in the project root, or install dotenv: 'npm install dotenv'.
Invalid configuration: middleware 'ui5-middleware-route-proxy' has unknown property 'afterMiddleware'
The 'afterMiddleware' property is placed incorrectly in the configuration object.
fix
Ensure 'afterMiddleware' is at the same level as 'name' and 'configuration', not inside 'configuration'.
TypeError: Cannot read property 'target' of undefined
Misconfigured route object; likely a missing route key or incorrect indentation in YAML.
fix
Check ui5.yaml: each route must be a key under 'configuration' with a 'target' property. Ensure proper YAML indentation.
Upgrade
Version history
1.0.10latest on npm
Audit
Dependencies
http-proxyrequiredCore proxy functionality; used to forward requests to target servers.
dotenvrequiredLoads environment variables from .env file for configuration.
Agent activity
15 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources