mead-plugin-source-proxy

2.0.0 • Public • Published

mead-plugin-source-proxy

npm versionBuild StatusCoverage StatusDependency status

HTTP Proxy source for the Mead image transformer service - loads images from remote HTTP(s) servers.

Installation

# Bundled with mead by default, but if you're feeling frisky
npm install --save mead-plugin-source-proxy

Usage

Note: Bundled with Mead and enabled by default

Your mead configuration file (mead --config <path-to-config.js>):

module.exports = {
  // Load the plugin
  plugins: [
    require('mead-plugin-source-proxy')
  ],

  // Define a source using the proxy adapter
  sources: [{
    name: 'my-proxy-source',
    adapter: {
      type 'proxy',
      config: {
        // Secure token is required for this source, to prevent abuse
        secureUrlToken: 'someToken',

        // Disallow requests to hostnames that resolve to private IP ranges (disallowed by default)
        allowPrivateHosts: false,

        // Optional, custom function to allow/disallow a request. Pass bool as second argument to the callback
        allowRequest: (url, callback) => {
          callback(null, url.includes('arnold'))
        },

        // Time in milliseconds to wait upon connecting to remote server before giving up request (default: 7500)
        timeout: 3500,

        // Maximum number of redirects to follow (default: 3)
        maxRedirects: 1
      }
    }
  }]
}

License

MIT-licensed. See LICENSE.

Package Sidebar

Install

npm i mead-plugin-source-proxy

Weekly Downloads

0

Version

2.0.0

License

MIT

Last publish

Collaborators

  • rexxars