diff --git a/src/app.js b/src/app.js index 39a12e92fb5483ce54fa571d0bf17c90444ddd1a..2481b238648ebd41dc8df53db282a3fd9bab6db7 100644 --- a/src/app.js +++ b/src/app.js @@ -57,14 +57,19 @@ const configureApp = app => { } // Allow CORS from client if host / port is different - app.use( - cors({ - origin: `${config.get('pubsweet-client.host')}:${config.get( - 'pubsweet-client.port', - )}`, - credentials: true, - }), - ) + if ( + config.has('pubsweet-client.host') && + config.has('pubsweet-client.port') + ) { + app.use( + cors({ + origin: `${config.get('pubsweet-client.host')}:${config.get( + 'pubsweet-client.port', + )}`, + credentials: true, + }), + ) + } // Register passport authentication strategies app.use(passport.initialize())