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.
On the client side I receive a 400 (Bad Request) error on both GET & 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.
My apache httpd.conf file is as follows:
ServerRoot "/home/< user >/webapps/< my_app >/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 < my_app > processes=2 threads=12 python-path=/home/< user >/webapps/< my_app >:/home/< user >/webapps/< my_app >/lib/python2.7
WSGIProcessGroup < my_app >
WSGIRestrictEmbedded On
WSGILazyInitialization On
WSGIScriptAlias / /home/< user >/webapps/< my_app >/wsgi.py
I've seen some posts about proxy_module & 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!