From d7090986ed33ad764f1dbe1b8dcd6b0cd7f238ba Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Sat, 20 May 2023 11:02:42 +0200 Subject: [PATCH] webrtc: add POST and PATCH methods to Access-Control-Allow-Methods --- 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 b8ecd534bdc..3ef24ee4f68 100644 --- a/internal/core/hls_http_server.go +++ b/internal/core/hls_http_server.go @@ -92,7 +92,7 @@ func (s *hlsHTTPServer) onRequest(ctx *gin.Context) { case http.MethodGet: case http.MethodOptions: - ctx.Writer.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS") + 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.WriteHeader(http.StatusOK) return diff --git a/internal/core/webrtc_http_server.go b/internal/core/webrtc_http_server.go index 7cedef2703b..a528cb9fe3b 100644 --- a/internal/core/webrtc_http_server.go +++ b/internal/core/webrtc_http_server.go @@ -182,7 +182,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) { case http.MethodGet: case http.MethodOptions: - ctx.Writer.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS") + 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.WriteHeader(http.StatusOK) return @@ -272,7 +272,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) { case "whip", "whep": switch ctx.Request.Method { case http.MethodOptions: - ctx.Writer.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS") + 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()["Link"] = iceServersToLinkHeader(s.parent.genICEServers()) ctx.Writer.WriteHeader(http.StatusOK)