ui5-middleware-proxy-basicauth

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

UI5 middleware for adding basic authentication to proxy requests in UI5 tooling (v0.0.6). It extends the simple proxy from the ui5-ecosystem-showcase, allowing developers to proxy OData or other services behind Basic Auth. Key differentiator: integrates seamlessly with UI5's custom middleware configuration (ui5.yaml) and reads credentials from environment variables (.env). Release cadence: low; last update was 2021. Compared to alternatives like ui5-middleware-proxy, this adds built-in auth support without extra libraries.

error Error: Cannot find module 'ui5-middleware-proxy-basicauth'
cause Package not installed or not declared in ui5.dependencies.
fix
Run 'npm install ui5-middleware-proxy-basicauth --save-dev' and add to ui5.dependencies in package.json.
error Proxy returns 401 Unauthorized
cause Missing or incorrect Basic Auth credentials in .env.
fix
Ensure .env file exists with PROXY_USERNAME and PROXY_PASSWORD set correctly.
error No middleware with name 'ui5-middleware-proxy-basicauth' found
cause Middleware name mismatch in ui5.yaml or missing dependency declaration.
fix
Verify the 'name' field matches exactly 'ui5-middleware-proxy-basicauth' and the package is installed.
error TypeError: Cannot read property 'proxy' of undefined
cause Configuration object missing 'baseUri' property.
fix
Add 'baseUri' under 'configuration' in ui5.yaml.
gotcha Credentials must be defined in .env file; otherwise, proxy fails silently.
fix Set PROXY_USERNAME and PROXY_PASSWORD environment variables.
gotcha The middleware requires the UI5 tooling dependency to be declared in both devDependencies and ui5.dependencies in package.json.
fix Add the package to both sections as shown in README.
gotcha mountPath must be a path prefix (e.g., /odata); otherwise, requests may not match.
fix Specify mountPath starting with /.
deprecated This package has not been updated since 2021 and may not support newer UI5 versions.
fix Check compatibility or consider using a maintained alternative.
npm install ui5-middleware-proxy-basicauth
yarn add ui5-middleware-proxy-basicauth
pnpm add ui5-middleware-proxy-basicauth

Configures the middleware in UI5's ui5.yaml and sets Basic Auth credentials via environment variables.

// Not a library with JS imports; configured in ui5.yaml.
// Example ui5.yaml:
server:
  customMiddleware:
  - name: ui5-middleware-proxy-basicauth
    afterMiddleware: compression
    mountPath: /odata
    configuration:
      baseUri: "http://services.odata.org"
      client: "110"

// Set credentials in .env:
PROXY_USERNAME=yourusername
PROXY_PASSWORD=yourpassword