Merge pull request #564 from embark-framework/features/whisper-cors

Added cors for whisper
This commit is contained in:
Iuri Matias 2018-06-20 16:40:46 -04:00 committed by GitHub
commit f16bb2c30b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -113,6 +113,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;

View File

@ -20,7 +20,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() {