failed: Error during WebSocket handshake: Unexpected response code: 400

Problem description: reference socket. Io in the project, after the project deployment error, local run no error
Reason for the error: You need to configure the information in the configuration file nginx.conf
Add in the location of the nginx file
Proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”.
The first line tells Nginx to use HTTP/1.1 when communicating with the Node backend, which is required by WebSockets. The next two lines tell Nginx to respond to the upgrade request, which is started by HTTP when the browser wants to use WebSocket. All three lines must be added.
Such as:

. Default_server;
listen [: :] : 80 default_server.
server_name localhost.
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
The location/{
proxy_pass http://localhost:3100;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”.
proxy_set_header Host $Host;


Read More: