Skip to content

Commit

Permalink
set Access-Control-Allow-Headers to a static string (#1973)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Jun 21, 2023
1 parent 5033d1e commit ba6c0fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/core/hls_http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions internal/core/webrtc_http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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())
}
Expand Down

0 comments on commit ba6c0fa

Please sign in to comment.