Monday, 10 April 2017

Nodejs broadcast and Notify is not working in IE & Chorme

I have configured the nodejs in my redhat server.

node -v v6.3.1

I am able to get the watchdog notification & broadcast in Firefox. But it is not working in Chorme & IE.

Chrome i am getting the below error

XMLHttpRequest cannot load http://xx.xx.xx.xx/cgi-bin/blockpage.cgi?ws-session=538380406. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. dblog:1 WebSocket connection to 'ws://xx.xx.xx:8081/socket.io/?EIO=3&transport=websocket&sid=5OHiSI5hThDzfC5sAAGz' failed: WebSocket is closed before the connection is established.

I have installed Cors

app.use(cors(corsOptions));

Tried with the below code

app.use(function (req, res, next) { res.setHeader('Access-Control-Allow-Origin', "*"); res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type'); next(); } );

Still it is not working

IE also Same issue bit sometime it working sometime not

Please help me resolve this issue



via Girija Swami

No comments:

Post a Comment