ah-cors-plugin
Configure CORS origins for Actionhero v18+
Install & Setup
-
npm install ah-cors-plugin --save
-
Register the plugin
// config/plugins.jsexports['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.jsexports 'default' ={return// Should the plugin be enabledenabled: false// List of origins that are allowed, all the rest will get `null` as `Access-Control-Allow-Origin`allowedOrigins: 'http://localhost:5000' || '*'}exportsproduction ={returnenabled: true}