與 iframe 一起使用的反向代理

與 iframe 一起使用的反向代理

天氣觀測-II

該網頁有以下連結:

天氣狀況視訊直播

此頁面呼叫 iframe 連結:

<iframe width-"1300" height="731" src="http://c500.duckdns.org:8889/backyard"></iframe>

/backyard 是攝影機串流 webRTC;來自 Raspberry Pi,運行 Wyze-Bridge docker 容器。視訊方案僅以 http 形式提供。這是混合內容,會被屏蔽。

是否可以使用nginx反向代理;那麼 /backyard 影片可以使用 https 方案嗎?

我正在使用 c500.duckdns.org 的 Duckdns;擁有 Letsencypt 憑證。無法從 iframe 呼叫生成視訊。

/etc/nginx/available-site/c500.duckdns.org 應該包含什麼?

server {
    listen 80;
    server_name observeredweather.000webhostapp.com;

    location / {
        proxy_pass http://localhost:443;  # Forward HTTP requests to HTTPS
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

server {
    listen 443 ssl;
    server_name c500.duckdns.org;

    ssl_certificate /etc/letsencrypt/live/npm-3/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/npm-3/privkey.pem;

    # Additional SSL configuration here if needed
    location / {
        # Configure your proxy settings for the HTTPS server here
        proxy_pass http://10.0.0.16:8889/backyard;  # Replace with your backend server's address
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

相關內容