同时代理http
2个服务:localhost:3000,localhost:8000,ws服务在localhost:3000上。
用nginx实现代理:
location /test/ {
proxy_pass http://localhost:8000/;
}
location / {
proxy_hide_header X-Frame-Options;
proxy_pass http://localhost:3000;
#代理ws
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Origin ""; #此句一定要加,不然cors不会通过
}