ah-cors-plugin
v0.1.1
Published
Actionhero plugin that allows configuring CORS origins
Downloads
12
Readme
ah-cors-plugin
Configure CORS origins for Actionhero v18+
Install & Setup
npm install ah-cors-plugin --save
Register the plugin
// config/plugins.js exports['default'] = { plugins: (api) => { return { + 'ah-cors-plugin': { path: path.join(__dirname, '/../node_modules/ah-cors-plugin') } } } }
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 } } }