title: Running Flask-SocketIO on WebFaction through mod_wsgi
body: <p>I have deployed a Flask application on Webfaction using mod_wsgi. My application is pretty simple but does implement Flask-SocketIO which is giving me troubles. My code works fine on my localhost but now that it is running on my Webfaction server the client is unable to connect to my socket. I'm not quite sure where my problems are coming from – I'm assuming I haven't set up my apache config file properly but this may not be true. </p>
  
  <p>On the client side I receive a 400 (Bad Request) error on both GET &amp; POST calls to the websocket. Intermittently I see a warning notifying me the socket closed before a connection was established. I also get an error occasionally stating that there was an error during WebSocket handshake.</p>
  
  <p>My apache httpd.conf file is as follows:</p>
  
  <pre><code>ServerRoot "/home/&lt; user &gt;/webapps/&lt; my_app &gt;/apache2"
  
  LoadModule authz_core_module modules/mod_authz_core.so
  LoadModule dir_module        modules/mod_dir.so
  LoadModule env_module        modules/mod_env.so
  LoadModule log_config_module modules/mod_log_config.so
  LoadModule mime_module       modules/mod_mime.so
  LoadModule rewrite_module    modules/mod_rewrite.so
  LoadModule setenvif_module   modules/mod_setenvif.so
  LoadModule wsgi_module       modules/mod_wsgi.so
  LoadModule unixd_module      modules/mod_unixd.so
  
  Listen 18161
  KeepAlive On
  SetEnvIf X-Forwarded-SSL on HTTPS=1
  ServerLimit 1
  StartServers 1
  MaxRequestWorkers 5
  MinSpareThreads 1
  MaxSpareThreads 3
  ThreadsPerChild 5
  
  WSGIDaemonProcess &lt; my_app &gt; processes=2 threads=12 python-path=/home/&lt; user &gt;/webapps/&lt; my_app &gt;:/home/&lt; user &gt;/webapps/&lt; my_app &gt;/lib/python2.7
  WSGIProcessGroup &lt; my_app &gt;
  WSGIRestrictEmbedded On
  WSGILazyInitialization On
  
  WSGIScriptAlias / /home/&lt; user &gt;/webapps/&lt; my_app &gt;/wsgi.py
  </code></pre>
  
  <p>I've seen some posts about proxy_module &amp; proxy_http_module but I'm not quite sure if I need that and if so how exactly to configure it. Any guidance on this issue would be much appreciated!</p>