I am attempting to move my server off my local subnet and to a domain. The main webpages are working and I have them behind an SSL. Apache does a rewrite of the url from any HTTP connection to an HTTPS. However when I attempt to connect with javascript from in browser with:
new WebSocket("wss://" + window.location.host);
I receive the following error:
WebSocket connection to 'wss://{MY_WEBSITE}.com/message_route/' failed: Error during WebSocket handshake: Unexpected response code: 404
My config for the settings.py is as follows:
"default": {
"BACKEND": "asgi_redis.RedisChannelLayer",
"ROUTING": "my_app.routing.channel_routing",
"Config": {
"hosts": [os.environ.get('REDIS_URL', 'redis://127.0.0.0:6379')],
}
},
EDIT (ADDED IN APACHE CONFIG DATA):
My Apache default.conf is the following (simple re-write to HTTPS):
<VirtualHost *:80>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
</VirtualHost>
Apache secure.conf:
<VirtualHost *:443>
ServerName my_domain.com
SSLEngine on
SSLProxyEngine on
SSLCertificateFile /etc/ssl/my_domain/my_domain.crt
SSLCertificateKeyFile /etc/ssl/my_domain/myserver.key
SSLCACertificateFile /etc/ssl/my_domain/my_domain.ca-bundle
Alias /static /home/user/my_app/myApp/static_files
<Directory /home/user/my_app/myApp/static_files>
Require all granted
</Directory>
<Directory /home/user/my_app/myApp/MyApp>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess MyApp python-path=/home/user/my_app/myApp/MyApp
WSGIProcessGroup MyApp
WSGIScriptAlias / /home/user/my_app/myApp/MyApp/MyApp/wsgi.py
</VirtualHost>
EDIT Found out apache is receiving request but not doing anything I tailed other_vhosts.access.log and found that when I created a new websocket in chromes console, apache logs that a GET request, but does not seem to forward it to my django app.
I also have a worker running, a redis server set up, and daphne running as well. Please let me know if you can think of any possible solutions to this problem