diff --git a/IPython/html/base/zmqhandlers.py b/IPython/html/base/zmqhandlers.py
index 1b741ae..6f34c96 100644
--- a/IPython/html/base/zmqhandlers.py
+++ b/IPython/html/base/zmqhandlers.py
@@ -48,6 +48,9 @@ class ZMQStreamHandler(websocket.WebSocketHandler):
origin_header = self.request.headers.get("Origin")
host = self.request.headers.get("Host")
+ if(origin_header == None or host == None):
+ return True
+
parsed_origin = urlparse(origin_header)
origin = parsed_origin.netloc