From bb3cfeec6f2072334beddc47d24fa9de99678d3c Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Sun, 13 Jul 2025 09:37:19 +0200 Subject: [PATCH] webrtc: fix re-establishing connection in iframe (#4721) Prevent a bug in Firefox in which, when the page is loaded in an iframe and the iframe is deleted and recreated, WebRTC is unable to re-establish the connection. --- internal/servers/webrtc/http_server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/servers/webrtc/http_server.go b/internal/servers/webrtc/http_server.go index 473196c9..89bcbaec 100644 --- a/internal/servers/webrtc/http_server.go +++ b/internal/servers/webrtc/http_server.go @@ -306,7 +306,11 @@ func (s *httpServer) onPage(ctx *gin.Context, pathName string, publish bool) { return } - ctx.Header("Cache-Control", "max-age=3600") + // Do not cache the HTML page. + // This prevents a bug in Firefox in which, when the page + // is loaded in an iframe and the iframe is deleted and recreated, + // WebRTC is unable to re-establish the connection. + ctx.Header("Cache-Control", "no-cache") ctx.Header("Content-Type", "text/html") ctx.Writer.WriteHeader(http.StatusOK)