title: Acces-Control-Allow-Origin with Grunt Server and Flask SocketIO-app
body: <p>I'm getting the following error message when trying too connect my angular app, run with the Grunt server, with a socketIO Flask app:</p>
  
  <pre><code>XMLHttpRequest cannot load http://localhost:8080/socket.io/1/?t=1381872821951. 
  Origin http://localhost:9000 is not allowed by Access-Control-Allow-Origin.
  </code></pre>
  
  <p>I have been doing some digging about this problem already and I know it comes from the fact the client (angularjs) is doing a request to a different server from which the response came.</p>
  
  <p>Which of the both servers is the problem? </p>
  
  <p>1) The Grunt Server? I already tried this: <a href="https://stackoverflow.com/a/17256255/1819058">https://stackoverflow.com/a/17256255/1819058</a>
  Which should solve the problem if it came from the Grunt server</p>
  
  <p>2) The Flask SocketIO server:</p>
  
  <pre><code>app = Flask(__name__)
  
  @app.route("/socket.io/&lt;path:path&gt;")
  def run_socketio(path):
      socketio_manage(request.environ, {'': ChatNamespace})
  
  if __name__ == '__main__':
      print 'Listening on http://localhost:8080'
      app.debug = True
      import os
      from werkzeug.wsgi import SharedDataMiddleware
      app = SharedDataMiddleware(app, {
          '/': os.path.join(os.path.dirname(__file__), 'static')
          })
      from socketio.server import SocketIOServer
      SocketIOServer(('', 8080), app,
          namespace="socket.io", policy_server=False).serve_forever()
  </code></pre>
  
  <p>This is how I connect to the server:</p>
  
  <pre><code>var socket = ioSocket || io.connect('http://localhost:8080');
  </code></pre>
  
  <p>Can somebody help me with this? Isn't it logic that requests go to another server if you are using websockets? </p>
  
  <p>Another strange note: The whole thing worked but stopped working after a reboot...</p>