同样的一份代码
var ws = new WebSocket('ws://' + window.location.host + window.location.pathname);
chrome的header 无cookie firfox的header 有cookie
为什么chrome ws请求header中没有cookie呢,有牛人能给我解答下么? 如何才能让chrome ws请求header中有cookie呢??
chrome中的header信息
GET ws://localhost:4567/games/matching-game/1 HTTP/1.1
Pragma: no-cache
Origin: http://localhost:4567
Host: localhost:4567
Sec-WebSocket-Key: 9NJMQbfnt2FSN2b2MkQ9cQ==
Upgrade: websocket
Sec-WebSocket-Extensions: x-webkit-deflate-frame
Cache-Control: no-cache
Connection: Upgrade
Sec-WebSocket-Version: 13
firefox中的header
GET /games/matching-game/1 HTTP/1.1
Host: localhost:4567
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Sec-WebSocket-Version: 13
Origin: http://localhost:4567
Sec-WebSocket-Key: iTKGrDte+JmWeHmpHnFCpQ==
Cookie: rack.session=BAh7CUkiD3Nlc3Npb25faWQGOgZFRiJFODNiOTA0NmJmZDcwNDM0NjVlYjNl%0AMGU3YThiNjU1OGM1ODkxZmYwYWVjOGFhNDUwOGVlN2QxMTdjOGRlMDEzMEki%0ADXRyYWNraW5nBjsARnsISSIUSFRUUF9VU0VSX0FHRU5UBjsARiItNTA1OTFk%0AZWE0YTk3MGM2ZGM2ODhhNzEzZTFlNWUyZWRlMzEzYzA3NUkiGUhUVFBfQUND%0ARVBUX0VOQ09ESU5HBjsARiItYTBiZmM4NzZkNjhmZTdhZWE3MDBkYTVlYTg5%0AMjVhYmFjNmYyZjc5NEkiGUhUVFBfQUNDRVBUX0xBTkdVQUdFBjsARiItNTBj%0AYTM5YWY5NDU1ZTM1NmY2ZTlkOTRjZjU4NzE4ZTQzNzdhZjI5NEkiCWNzcmYG%0AOwBGIkU1Yzk1ZTQ5NTlhN2YwNjVhZDE2YTA1ZWYyMjFkMWY0ODNjMzc1Yzlh%0ANWQxZDQ4NmFhMThhYmRjYjA5ZDE1OTRlSSIMdXNlcl9pZAY7AEZpBg%3D%3D%0A--8122297af5825b47cfae2bf8f30342551dfba2a4
Connection: keep-alive, Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket