当signalR在带有nginx反向代理的docker上运行时,为什么signalR无法向客户端发送消息?

时间:2019-04-11 13:25:46

标签: docker nginx signalr asp.net-core-webapi nginx-location

当signalR集线器在localhost上运行时,我可以接收到它的消息,但是当我将程序放在使用nginx反向代理的服务器上时,我可以连接到signalR集线器,但是不能接收来自它。不知道为什么这是nginx.conf配置文件的问题吗?此外,无论是否在Nginx反向代理上运行,我都可以在本地主机上运行该网站图标,但是在linux服务器上运行该网站图标却看不到。

我尝试修改nginx.conf文件,我尝试了所有以下命令: proxy_set_header连接保持活动;或: proxy_set_header连接“升级”;或: proxy_set_header连接$ http_connection; 我不知道问题是什么。

server {
server_name www.website.com;
listen 80;
listen 443 ssl;
ssl_certificate 1_www.website.com_bundle.crt;
ssl_certificate_key 2_www.website.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;

location / {
proxy_pass http://www.website.com:5050;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;


}
} 

我希望在服务器上运行的signalR集线器可以将消息发送到客户端,但是现在我只能在本地主机上运行该程序时才能发送消息。 感谢帮助。 弗兰克

0 个答案:

没有答案