UI5 Middleware HTTP Proxy

raw JSON →
2.1.0 verified Sat Apr 25 auth: no javascript

Custom UI5 tooling middleware extension for proxying HTTP requests to remote services during local development. Version 2.1.0 supports HTTP basic authentication, self-signed certificates, and debug logging. Released on npm, active maintenance. Key differentiators: simple YAML configuration, native integration with UI5 Tooling's middleware lifecycle, and optional .env file support via dotenv. Compared to generic proxies, it is tailored for UI5 projects and works seamlessly with openui5-sdk-docker.

error Error: Cannot find module 'ui5-middleware-http-proxy'
cause The package is not installed or not declared as a UI5 dependency in package.json.
fix
Run npm install --save-dev ui5-middleware-http-proxy and add "ui5": { "dependencies": ["ui5-middleware-http-proxy"] } to your package.json.
error UI5 server fails with 'afterMiddleware' not defined
cause The 'afterMiddleware' property is missing or misspelled in ui5.yaml custom middleware configuration.
fix
Add afterMiddleware: compression (or another valid middleware) to each custom middleware entry.
error ECONNREFUSED when proxying to localhost
cause The baseUrl is pointing to a service that is not running or the port is incorrect.
fix
Verify the target service is running and the baseUrl/port is correct. Use debug: true to see the proxied URL.
deprecated The 'request' library used internally is deprecated and will stop receiving security fixes. Consider migrating to a native fetch or http-proxy.
fix Monitor repository for updates that replace request with a modern HTTP client.
gotcha Dotenv support only resolves variables prefixed with 'env:'. Direct values are not automatically expanded.
fix Prefix your auth values with 'env:' to use environment variables, e.g., `user: env:MY_USER`.
gotcha Configuration option 'secure' defaults to true, rejecting self-signed certificates. This may cause unexpected failures when proxying to servers with self-signed certs.
fix Explicitly set `secure: false` in the configuration if you need to accept self-signed certificates.
gotcha Mount path and configuration path must match because the middleware rewrites the request URL by removing the mountPath and prepending the configured path.
fix Ensure that `mountPath` and `configuration.path` are consistent; typically both set to the same value (e.g., '/resources').
npm install ui5-middleware-http-proxy
yarn add ui5-middleware-http-proxy
pnpm add ui5-middleware-http-proxy

Install, register in package.json, and configure middleware in ui5.yaml with basic auth and debug enabled.

npm install --save-dev ui5-middleware-http-proxy
# Add to package.json:
{
  "ui5": {
    "dependencies": ["ui5-middleware-http-proxy"]
  }
}
# Add to ui5.yaml:
server:
  customMiddleware:
    - name: ui5-middleware-http-proxy
      mountPath: /myapi
      afterMiddleware: compression
      configuration:
        baseUrl: https://api.example.com
        path: /v1
        debug: true
        secure: false
        auth:
          user: env:API_USER
          pass: env:API_PASS