title: Django Channels wss not connecting received 404 Error
body: <p>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:</p>
  
  <pre><code>new WebSocket("wss://" + window.location.host);
  </code></pre>
  
  <p>I receive the following error:</p>
  
  <pre><code>WebSocket connection to 'wss://{MY_WEBSITE}.com/message_route/' failed: Error during WebSocket handshake: Unexpected response code: 404
  </code></pre>
  
  <p>My config for the settings.py is as follows:</p>
  
  <pre><code>"default": {
      "BACKEND": "asgi_redis.RedisChannelLayer",
      "ROUTING": "my_app.routing.channel_routing",
      "Config": {
              "hosts": [os.environ.get('REDIS_URL', 'redis://127.0.0.0:6379')],
      }
  },
  </code></pre>
  
  <p><strong>EDIT (ADDED IN APACHE CONFIG DATA):</strong></p>
  
  <p>My Apache default.conf is the following (simple re-write to HTTPS):</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      RewriteEngine on
      RewriteCond %{HTTPS} !=on
      RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Apache secure.conf:</p>
  
  <pre><code>&lt;VirtualHost *:443&gt;
      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
  
      &lt;Directory /home/user/my_app/myApp/static_files&gt;
          Require all granted
      &lt;/Directory&gt;
  
      &lt;Directory /home/user/my_app/myApp/MyApp&gt;
          &lt;Files wsgi.py&gt;
              Require all granted
          &lt;/Files&gt;
      &lt;/Directory&gt;
      WSGIDaemonProcess MyApp python-path=/home/user/my_app/myApp/MyApp
      WSGIProcessGroup MyApp
      WSGIScriptAlias / /home/user/my_app/myApp/MyApp/MyApp/wsgi.py
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p><strong>EDIT Found out apache is receiving request but not doing anything</strong>
  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.</p>
  
  <p>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</p>