set Access-Control-Allow-Headers to a static string (#1973)

This commit is contained in:
Alessandro Ros 2023-06-22 00:16:19 +02:00 committed by GitHub
parent 5033d1e145
commit ba6c0fa822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ func (s *hlsHTTPServer) onRequest(ctx *gin.Context) {
switch ctx.Request.Method { switch ctx.Request.Method {
case http.MethodOptions: case http.MethodOptions:
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET") 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) ctx.Writer.WriteHeader(http.StatusOK)
return return

View File

@ -181,7 +181,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
switch ctx.Request.Method { switch ctx.Request.Method {
case http.MethodOptions: case http.MethodOptions:
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET") 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) ctx.Writer.WriteHeader(http.StatusOK)
return return
@ -275,7 +275,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
switch ctx.Request.Method { switch ctx.Request.Method {
case http.MethodOptions: case http.MethodOptions:
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, POST, PATCH") 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 { if authRes.err == nil {
ctx.Writer.Header()["Link"] = iceServersToLinkHeader(s.parent.genICEServers()) ctx.Writer.Header()["Link"] = iceServersToLinkHeader(s.parent.genICEServers())
} }