I am creating an application using Licode, this is a video conference application in which i have created a room though the XMLHttpRequest call but no able to make connection using XMLHttpRequest following error occurs.
XMLHttpRequest cannot load http://domain.com:8080/socket.io/1/?t=1416289828054. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://domain.com:3001' is therefore not allowed access. The response had HTTP status code 404.
I am facing this issue even i have implemented following code on server
app.use(function(req, res, next) {
"use strict";
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Origin', 'http://'+req.headers.host+':8000');
res.header("Access-Control-Allow-Headers", "X-Requested-With");
res.header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, DELETE');
res.header('Access-Control-Allow-Headers', 'origin, content-type');
if (req.method == 'OPTIONS') {
res.send(200);
} else {
next();
}
});
thanks in advance for your help.
Seems like I had the similar issue (everything works fine util I deployed it on server). First of all check all firewalls and access to socket port from your computer. In my case, the issue was with F5, see here.
Note:
Because F5 will default protocol identified as http, so we need disable the http protocol,like this when HTTP_REQUEST { if { ([HTTP::uri] starts_with "/socket.io") } { HTTP::disable } }
Hope, I helped you ;)