Miss any of our Open RFC calls?Watch the recordings here! »

ah-cors-plugin

0.1.1 • Public • Published

ah-cors-plugin

CircleCI

Configure CORS origins for Actionhero v18+


NPM | GitHub


Install & Setup

  1. npm install ah-cors-plugin --save

  2. Register the plugin

    // config/plugins.js
    exports['default'] = {
      plugins: (api) => {
        return {
    +      'ah-cors-plugin': { path: path.join(__dirname, '/../node_modules/ah-cors-plugin') }
        }
      }
    }
     
  3. Configure the origins or use ALLOWED_ORIGINS environment

    // config/cors.js
    exports[ 'default' ] = {
      cors: () => {
        return {
          // Should the plugin be enabled
          enabled: false,
          // List of origins that are allowed, all the rest will get `null` as `Access-Control-Allow-Origin`
          allowedOrigins: [ 'http://localhost:5000' ] || '*'
        }
      }
    }
     
    exports.production = {
      cors: () => {
        return {
          enabled: true
        }
      }
    }
     

Install

npm i ah-cors-plugin

DownloadsWeekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

11 kB

Total Files

9

Last publish

Collaborators

  • avatar