What I have
I have Socket.IO
app letteraly from template
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const { Server } = require("socket.io");
const io = new Server(server);
io.on('connection', (socket) => {
console.log('a user connected');
});
server.listen(3000, () => {
console.log('listening on *:3000');
});
And I configured Apache
<VirtualHost *:443>
ServerName ws.domain.com
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
SSLEngine on
SSLCertificateFile /root/origin.pem
SSLCertificateKeyFile /root/private.key
</VirtualHost>
When I try to send request via Postman to localhost:3000
everything works
But when I try to send request to ws.domain.com
I always get 400 Bad Request
What I tried
- I tried to configure Apache from docs this does not helped me
- I tried to use
Nginx
and I configured it from docs its also does not helped me
- I tried to rewrite server on
Flask
with PySocketIO
and also with flask-socketio
, and get same error
I am already completely desperate and do not understand what the problem is.
P.S. If this can be important, I use CentOS 7
. I proxy the domain through the Cloudflare
and there the websockets are of course connected
P.S.S. All my other HTTP applications on the server work correctly (via Apache), the problem is only in websockets