'Apache + NodeJS (React) + SocketIO + HTTPS (SSL)

can anybody help me setup enviroment for my React application? I have installed Apache, NodeJS and SocketIO. HTTPS works well, but I have problem with Websockets. React development server not working for me, it say's wss://mydomain.com/ws/sockjs-node failed. And same problem is with SocketIO on port 4001. It says connection refused. I have no idea what to do with it. My React app is running on port 3000. Can anyone help me?

My apache config for domain:

<VirtualHost *:443>
    SSLEngine on
    DocumentRoot /data/www/mydomain.com/www
    ServerName mydomain.com
    ServerAlias www.mydomain.com

    ProxyPreserveHost On

    ProxyRequests Off
    ProxyVia Full

    <Proxy *>
        Require all granted
    </Proxy>

    <Location /ws>
        ProxyPass wss://localhost:3000/
        ProxyPassReverse wss://localhost:3000/
    </Location> 
  
    <Location />
        ProxyPass http://localhost:3000/ retry=2
        ProxyPassReverse http://localhost:3000/
    </Location> 
                        
    LogFormat "%h %V %l %u %t \"%r\" %s %b" vcommon
    CustomLog /data/www/mydomain.com/logs/access.log vcommon

    ErrorLog /data/www/mydomain.com/logs/error.log

    <Directory /data/www/mydomain.com>
        Options FollowSymlinks
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

Thanks for help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source