npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ui5-middleware-proxy-debug

v0.7.2

Published

UI5 simple proxy middleware

Downloads

2

Readme

UI5 simple proxy middleware

Middleware for ui5-server, enabling proxy support.

Install

npm install ui5-middleware-simpleproxy --save-dev

Configuration options (in $yourapp/ui5.yaml)

  • baseUri: string The baseUri to proxy. Can also be set using the UI5_MIDDLEWARE_SIMPLE_PROXY_BASEURI environment variable.
  • strictSSL: boolean Ignore strict SSL checks. Default value true. Can also be set using the UI5_MIDDLEWARE_SIMPLE_PROXY_STRICT_SSL environment variable.
  • limit: string This sets the body size limit (default: 1mb). If the body size is larger than the specified (or default) limit, a 413 Request Entity Too Large error will be returned. See bytes.js for a list of supported formats.
  • removeETag: boolean Removes the ETag header from the response to avoid conditional requests.
  • username: string Username used for Basic Authentication.
  • password: string Password used for Basic Authentication.
  • httpHeaders: map Http headers set for the proxied request. Will overwrite the http headers from the request.
  • query: map Query parameters set for the proxied request. Will overwrite the parameters from the request.
  • excludePatterns: string[] Array of exclude patterns using glob syntax

In general, use of environment variables or values set in a .env file will override configuration values in the ui5.yaml.

Usage

  1. Define the dependency in $yourapp/package.json:
"devDependencies": {
    // ...
    "ui5-middleware-simpleproxy": "*"
    // ...
},
"ui5": {
  "dependencies": [
    // ...
    "ui5-middleware-simpleproxy",
    // ...
  ]
}

As the devDependencies are not recognized by the UI5 tooling, they need to be listed in the ui5 > dependencies array. In addition, once using the ui5 > dependencies array you need to list all UI5 tooling relevant dependencies.

  1. configure it in $yourapp/ui5.yaml:
server:
  customMiddleware:
  - name: ui5-middleware-simpleproxy
    afterMiddleware: compression
    mountPath: /odata
    configuration:
      baseUri: "https://services.odata.org"
      username: myUsername
      password: myPassword
      httpHeaders:
        Any-Header: AnyHeader
      query:
        sap-client: 206
      excludePatterns:
      - "/local/**"

How it works

The middleware launches a simple proxy-server which proxies the requests to the given uri. Internally, it uses the express proxy middleware.

How to ignore self-signed certificates?

In case you are using HTTPS and self-signed certificates, you may see an error as displayed below:

Error: unable to verify the first certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1321:34)
    at TLSSocket.emit (events.js:210:5)
    at TLSSocket._finishInit (_tls_wrap.js:794:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:608:12)

To avoid it, you can set the strictSSL value in proxy request to be false. Its default value is true.

server:
  customMiddleware:
  - name: ui5-middleware-simpleproxy
    afterMiddleware: compression
    mountPath: /odata
    configuration:
      baseUri: "http://services.odata.org"
      strictSSL: false

.env support

This plugin supports use of a .env file to declare environment variable values for configuration as described above. The file should be put in the same directory where you run ui5 build, ui5 serve, etc. The file might have contents like:

UI5_MIDDLEWARE_SIMPLE_PROXY_BASEURI=https://host.tld:1234/sap
UI5_MIDDLEWARE_SIMPLE_PROXY_STRICT_SSL=false
UI5_MIDDLEWARE_SIMPLE_PROXY_USERNAME=myUsername
UI5_MIDDLEWARE_SIMPLE_PROXY_PASSWORD=myPassword

Hints

If you are using the Microsoft OData services for testing purposes, like Northwind, please ensure to use the https URLs instead of the http URLs. The http URL will redirect to https but instead of the proxy it will try to directly connect to the Microsoft OData services.

License

This work is dual-licensed under Apache 2.0 and the Derived Beer-ware License. The official license will be Apache 2.0 but finally you can choose between one of them if you use this work.

When you like this stuff, buy @vobu a beer or buy @pmuessig a coke when you see them.