gpt4 book ai didi

asp.net - cloudflare下如何配置nginx支持signalr3?

转载 作者:行者123 更新时间:2023-12-04 15:29:54 26 4
gpt4 key购买 nike

我正在努力处理 signalr3 和 nginx 反向代理配置,我的 nginx cfg 看起来像这样:

server {
listen 80;
server_name my.customdomain.com;

location / {
root /pages/my.customdomain.com;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}

## send request back to kestrel ##
location /proxy/ {
proxy_pass http://xxxxxxxxxx.westeurope.cloudapp.azure.com/;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

我在这里想念什么?

当我浏览我的页面时,我收到 OK for
GET /proxy/notifications/negotiate 


GET /proxy/notifications?id=uFQtMDg1dXib6LGvUssQhQ

但是 404 用于 POST
POST proxy/notifications?id=uFQtMDg1dXib6LGvUssQhQ

请停下来!

附:我的集线器很简单...
[AllowAnonymous]
public class NotificationHub : Hub
{

}

最佳答案

这是一个基于 websocket 的应用程序,所以你需要额外的 nginx 配置

location / { 
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
#proxy_set_header X-Forwarded-Proto https;
proxy_pass 127.0.0.1:8080;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}

关于asp.net - cloudflare下如何配置nginx支持signalr3?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50937444/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com