title: Flask SocketIO - CORS issue
body: <p>I'm trying to use Flask-SocketIO to add websocket functionality to my application.</p>
  
  <p>My application architecture is heavily decoupled and as a result I want to use a different set of servers for handling the websocket stuff. However, in my testing I'm using the same server with just different ports.</p>
  
  <p>When I try and connect in JavaScript with:</p>
  
  <pre><code>&lt;script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" charset="utf-8"&gt;
      var socket = io.connect("http://dev.example.com:8000");
      socket.on('connect', function() {
          socket.emit('my event', {data: 'I\'m connected!'});
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://dev.example.com:8000/socket.io/1/?t=1442224745873. (Reason: CORS request failed).
  </code></pre>
  
  <p>So to mitigate this, I did some CORS stuff and added the <code>crossorigin</code> defined here: <a href="http://flask.pocoo.org/snippets/56/" rel="nofollow">http://flask.pocoo.org/snippets/56/</a></p>
  
  <p>I won't post the code for the decorator as I haven't changed it from what is on the above webpage.</p>
  
  <p>And then on my endpoint, I've used the decorator:</p>
  
  <pre><code>@app.route('/socket/')
  @crossdomain(origin='http://dev.example.com:8000', headers='Content-Type')
  def socket():
      return render_template('socket.html')
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code>@app.route('/socket/')
  @crossdomain(origin='*', headers='Content-Type')
  def socket():
      return render_template('socket.html')
  </code></pre>
  
  <p>And in the HTTP response headers of loading the /socket/ endpoint I can see the headers:</p>
  
  <pre><code>Access-Control-Allow-Headers:Content-Type
  Access-Control-Allow-Methods:HEAD, OPTIONS, GET
  Access-Control-Allow-Origin:http://dev.example.com:8000
  Access-Control-Max-Age:21600
  Content-Length:448
  Content-Type:text/html; charset=utf-8
  Date:Mon, 14 Sep 2015 10:20:09 GMT
  Server:Werkzeug/0.10.4 Python/2.7.9
  </code></pre>
  
  <p>But I still get the CORS error. Anyone got any ideas? :)</p>