From 0f69ebcccbd0fd0c34b6f5ddb2bdb561d0de97ff Mon Sep 17 00:00:00 2001 From: Emiliano Frascaro Date: Fri, 19 Jun 2026 19:15:04 +0200 Subject: [PATCH] Instrada /hls/ su Rails per evitare redirect HTTP nel browser. MediaMTX reindirizzava a http:// su pagine HTTPS; il proxy Rails segue i redirect lato server. Co-authored-by: Cursor --- infra/nginx-edge/nginx.conf | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/infra/nginx-edge/nginx.conf b/infra/nginx-edge/nginx.conf index 2d94e82..84b266d 100644 --- a/infra/nginx-edge/nginx.conf +++ b/infra/nginx-edge/nginx.conf @@ -55,30 +55,23 @@ http { proxy_set_header If-Range $http_if_range; } - # HLS live/regia: proxy diretto a MediaMTX (non passa da Puma). + # HLS live/regia: proxy via Rails (segue redirect/cookie MediaMTX lato server). + # Evita redirect http:// nel browser (mixed content su pagina HTTPS). location /hls/ { limit_except GET HEAD { deny all; } - rewrite ^/hls/(.*)$ /$1 break; - proxy_pass http://mediamtx:8888; + proxy_pass http://$rails_backend; proxy_http_version 1.1; proxy_buffering off; proxy_request_buffering off; proxy_connect_timeout 5s; proxy_read_timeout 3600s; proxy_set_header Host $host; - proxy_set_header Cookie $hls_cookie; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $forwarded_proto; - # MediaMTX risponde 302 con Location http://… — il browser HTTPS lo blocca. - proxy_redirect http://$host/ https://$host/; - proxy_redirect http://$http_host/ https://$host/; - # MediaMTX risponde 302 verso /live/match_{uuid}/… — riscrive per restare sotto /hls/ - proxy_redirect /live/ /hls/live/; - proxy_redirect ~^/live/(.*)$ /hls/live/$1; } # HLS cookie redirect di MediaMTX: passa da Rails (proxy con follow interno).