I'm using the nginx as reverse proxy for django and React with as config
worker_processes 1;
events {
worker_connections 1024;
}
http{
server{
include mime.types;
default_type application/octet-stream;
keepalive_timeout 240;
sendfile on;
listen 8001;
server_name 127.0.0.1;
location /{
proxy_pass http://localhost:3000;
}
location /backend {
proxy_pass http://127.0.0.1:8000;
}
}
}
its working fine but i want to forward websocket for react hot loading. i have still no solution after lot of googling. currently it have connection error as from chrome console
WebSocket connection to 'ws://127.0.0.1:8001/sockjs-node' failed: Error during WebSocket handshake: Unexpected response code: 404
Copyright Notice:Content Author:「Naresh Teli」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/65324178/forward-websocket-to-websocket