indutny / sticky-session

Sticky session balancer based on a `cluster` module
964 stars 99 forks source link

Sticky-Session not working in IE and FireFox #13

Open doanmanhsonha opened 9 years ago

doanmanhsonha commented 9 years ago

Hi everyone, I write a simple code to try sticky-session and socket-io. With Google Chrome, I can see "Hello World!" return. IE and FF keep loading and nothing return. Can you give me hint how to settle my problem? Here is the source: var sticky = require('sticky-session'); var fs = require('fs'); sticky(function () { // This code will be executed only in slave workers

var http = require('http'),
    io = require('socket.io');

var server = http.createServer(function (req, res) {
    if (req.url === '/' || req.url === '/index.html') { 
        fs.readFile(__dirname + '/statics/html/index.html',
        function (err, data) {
            if (err) {
                res.writeHead(500);
                return res.end('Error loading index.html');
            }

            res.writeHead(200, {'Content-Type': 'text/html'});
            res.end(data);
        });
    }
});
io.listen(server);

return server;

}).listen(8000, function () { console.log('server started on 8000 port'); });

Index.html <!DOCTYPE html>

Hello

World!

Sifogiannos commented 9 years ago

I had the same problem even sometimes with Chrome and Safari!!! I think the problem is somewhere in the ip hash.

aidanxyz commented 9 years ago

Same problem here. Any news on this issue? How do you make it work on FF, IE?

lyenliang commented 9 years ago

This problem always occurs on my IE. Sometimes it works correctly on my Firefox, and Chrome.