igrigorik / em-websocket

EventMachine based WebSocket server

Home Page:http://www.igvita.com/2009/12/22/ruby-websockets-tcp-for-the-browser/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handling cross-origin requests

Gargron opened this issue · comments

How would you go about restricting access to a whitelist of origins? Would you compare the origin header socket.request['origin'] on connection start, and close it if there's no match?

Basically yes - I'd check handshake.origin in the onopen block and close the connection with an appropriate close code if the origin was not valid.