Hello everybody,
When i try to access Node JS with socket.io and https i have an error.
My app
var https = require('https');
var fs = require('fs');
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
host: 'localhost:9200'/*,
log: 'trace'*/
});
var options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
var serverhttps = https.createServer(options, function (req, res) {});
var io = require('socket.io').listen(serverhttp);
io.set('origins', '*:*');
// Quand on client se connecte
io.sockets.on('connection', function (socket) {
console.log('Connecte');
// Quand on reçoit un appel search
socket.on('search', function (obj) {
client.search(obj.searchQuery, function (error, reponse) {
socket.emit('returnResultElasticsearch', {'searchType':obj.
searchType, 'searchResult':reponse});
});
});
// Quand on reçoit un appel suggest
socket.on('suggest', function (obj) {
client.suggest(obj.suggestQuery, function (error, reponse) {
socket.emit('returnResultAutoCompletion', {'suggestType':obj.
suggestType, 'suggestResult':reponse});
});
});
});
serverhttp.listen(8080, "0.0.0.0");
My client
var socket = io.connect('https://my.domain:8080', {
'reconnect':false
});
I have the message error
https://my.domain:8080/socket.io/?EIO=3&transport=polling&t=1424795460423-0
A multi-origin request was blocked: the policy "Same origin" does not allow
to see remote resource located in
https://my.domain:8080/socket.io/?EIO=3&transport=polling&t=1424795460423-0
<https://api.imgur.com/3/upload>. this an be fixed by moving the resource
on the samin domain or by enabling CORS.
Can you help me please ?
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/da3a473b-7a91-417e-b2ab-413bd991a0d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.