diff --git a/lib/core/config.js b/lib/core/config.js index 785c75b27..e350f7ddb 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -117,6 +117,10 @@ Config.prototype._updateBlockchainCors = function(){ corsParts.push(utils.buildUrlFromConfig(storageConfig.upload)); } } + // add whisper cors + if(this.communicationConfig && this.communicationConfig.enabled && this.communicationConfig.provider === 'whisper'){ + corsParts.push('embark'); + } let cors = corsParts.join(','); if(blockchainConfig.rpcCorsDomain === 'auto' && cors.length) blockchainConfig.rpcCorsDomain = cors; diff --git a/lib/modules/whisper/index.js b/lib/modules/whisper/index.js index 06d7ce795..7206d452b 100644 --- a/lib/modules/whisper/index.js +++ b/lib/modules/whisper/index.js @@ -22,7 +22,7 @@ class Whisper { connectToProvider() { let {host, port} = this.communicationConfig.connection; let web3Endpoint = 'ws://' + host + ':' + port; - this.web3.setProvider(new Web3.providers.WebsocketProvider(web3Endpoint, {headers: {Origin: "http://localhost:8000"}})); + this.web3.setProvider(new Web3.providers.WebsocketProvider(web3Endpoint, {headers: {Origin: "embark"}})); } setServiceCheck() {