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 <cursoragent@cursor.com>
This commit is contained in:
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user