From ba6c0fa822930d6138d12c5189277a3fcd11df3a Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Thu, 22 Jun 2023 00:16:19 +0200 Subject: [PATCH] set Access-Control-Allow-Headers to a static string (#1973) --- internal/core/hls_http_server.go | 2 +- internal/core/webrtc_http_server.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/core/hls_http_server.go b/internal/core/hls_http_server.go index cda1113c..53c3ac52 100644 --- a/internal/core/hls_http_server.go +++ b/internal/core/hls_http_server.go @@ -91,7 +91,7 @@ func (s *hlsHTTPServer) onRequest(ctx *gin.Context) { switch ctx.Request.Method { case http.MethodOptions: ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET") - ctx.Writer.Header().Set("Access-Control-Allow-Headers", ctx.Request.Header.Get("Access-Control-Request-Headers")) + ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Range") ctx.Writer.WriteHeader(http.StatusOK) return diff --git a/internal/core/webrtc_http_server.go b/internal/core/webrtc_http_server.go index 97547470..46a47a47 100644 --- a/internal/core/webrtc_http_server.go +++ b/internal/core/webrtc_http_server.go @@ -181,7 +181,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) { switch ctx.Request.Method { case http.MethodOptions: ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET") - ctx.Writer.Header().Set("Access-Control-Allow-Headers", ctx.Request.Header.Get("Access-Control-Request-Headers")) + ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, If-Match") ctx.Writer.WriteHeader(http.StatusOK) return @@ -275,7 +275,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) { switch ctx.Request.Method { case http.MethodOptions: ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, POST, PATCH") - ctx.Writer.Header().Set("Access-Control-Allow-Headers", ctx.Request.Header.Get("Access-Control-Request-Headers")) + ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, If-Match") if authRes.err == nil { ctx.Writer.Header()["Link"] = iceServersToLinkHeader(s.parent.genICEServers()) }