Nonlinear Performance Magnification


    0.1.1 • Public • Published

    @hitchy/plugin-proxy pipeline status

    Hitchy plugin implementing reverse proxy for redirecting selected requests to remote servers




    npm i @hitchy/plugin-proxy


    Proxies are defined as part of your application's configuration under top-level name proxy. In compliance with Hitchy's conventions you should create a file config/proxy.js in your Hitchy-based application. The proxy configuration itself is an array of objects each one defining another reverse proxy.

    Every such configuration object must consist of these mandatory properties:

    • prefix is declaring a local a routing prefix. All incoming requests matching this prefix are processed as part of this proxy definition.

      Due to the way Hitchy is handling its routing table, other plugins or current application may define more specific prefixes used in preference over any prefix defined here. Thus, it is possible to use prefix / here and still have a local API with prefix /api or similar.

    • target provides base URL of a remote service all processed requests are forwarded to.

    In addition, either configuration object may include any of these optional properties:

    • alias is providing one or more aliases. See below for additional information.

    • responseFilter is a method processing every response received from remote service due to forwarding some incoming request there. It is invoked prior to receiving and forwarding the response body. Provided arguments are

      1. the response received from remote service to inspect and probably adjust or replace,
      2. the request received from client in the first place and
      3. the request forwarded to the remote service.

      This method is meant to inspect status and header of provided response, maybe adjust it and/or returning a replacement for the actually received response. It may return a promise to delay this information. On falsy return value, the original response from remote service is used.

    • opaque is a boolean switch. When set, forwarded requests don't contain headers exposing IP addresses of actual clients any request has been forwarded for. This includes Forwarded-For,X-Forwarded-For, X-Forwarded-Host, X-Forwarded-Proto and X-Real-IP.


    exports.proxy = [
            prefix: "/ddg",
            target: "",
            alias: "",
            prefix: "/denic",
            target: "",
            prefix: "/denic-alt",
            target: "",
            responseFilter( backendResponse ) {
                if ( backendResponse.statusCode === 401 ) {
                    backendResponse.statusCode = 403;
                    backendResponse.removeHeader( "WWW-Authenticate" );
            opaque: true,

    This configuration file is defining three reverse proxies:

    • The first one is forwarding all requests for routes starting with /ddg to the base URL so that requesting /ddg/assets/dax.svg will eventually deliver the resource available at

    • The second one is forwarding requests with prefix /denic to

    • The third one is basically working like second one. However, all responses with status 401 are transformed into responses with status 403.


    Every proxy may declare one or more aliases used on mapping URls returned from target back into address space used in request sent to the proxy itself. Aliases are useful e.g. to test and develop backends prepared to run at different URL when in production setup.


    In first example above a forwarded request might cause response redirecting to URL which is translated back to redirecting to /ddg/index.html prior to returning it to the client. However, this translation fails when remote service redirects to instead for it is assumed to be an alias for the same site. By adopting this alias in your configuration even this URL gets translated back to /ddg/index.html properly.



    npm i @hitchy/plugin-proxy

    DownloadsWeekly Downloads






    Unpacked Size

    19.7 kB

    Total Files


    Last publish


    • soletan
    • simon.friedo