同時(shí)代理http
2個(gè)服務(wù):localhost:3000,localhost:8000,ws服務(wù)在localhost:3000上。
用nginx實(shí)現(xiàn)代理:
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不會(huì)通過
}