我已经在ubuntu上部署了Asp.Net Core2网站,并使用Nginx作为反向代理。网站可以工作,但SignalR不能,同样的构建可以在IIS-Express中本地工作。在日志中获取以下错误,通过发送204响应终止长轮询连接。
按照我正在使用的nginx配置,
server {
listen 80;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}我正在从Xamarin Android访问服务器。问题可能是什么?任何帮助都是最好的。提前谢谢。
发布于 2017-10-10 20:22:56
您应该更改配置以添加需要Upgrade标头的附加路径
server {
listen 80;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /socket/path/ {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}https://stackoverflow.com/questions/46663475
复制相似问题