赞
踩
webscoket.js:26 WebSocket connection to ‘ws://localhost:8088/DreamWeb/ctrl/websocketServer.do?userId=180627211146gYHGYcQlcBFRqW8nRUC’ failed: Error during WebSocket handshake: Unexpected response code: 403
一,WebSocket 设置为不允许跨域。
二,服务器/代理服务器不支持WebSocket
在websocket连接注册时设置允许跨域
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
ip_hash;
server 127.0.0.1:9090 weight=2;
server 127.0.0.1:9091 weight=2;
}
server {
listen 8088;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Origin '';
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_connect_timeout 1800;
proxy_read_timeout 900;
proxy_send_timeout 900;
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。