302 重定向到上游服务器 Nginx

我使用 Upstream 制作了一个负载均衡器,如下所示。

*
*
*
   upstream appservers {
    least_conn;
        server srv1.domain.com:443;
        server srv2.domain.com:443;
    }
*
*
*
    server {
        listen 443 ssl http2;

        server_name domain.com:443;

        location /hls {
        proxy_pass https://appservers/hls;
         }
    }
*
*
*

我设置了类似上面的 nginx.conf。

它现在运行得很好,但主服务器 domain.com:443 受到实时流的严重影响。我该如何将此流量 302 转发到边缘服务器?

因此,我想将每个传入请求都直接转发到最终服务器上。

domain.com/hls/test.m3u8 > srv1.domain.com/hls/test.m3u8

domain.com/hls/test.m3u8 > srv2.domain.com/hls/test.m3u8

* *

我想将实时流分配给上游服务器。

谢谢。

原文链接 https://stackoverflow.com/questions/70523242

点赞