hls, webrtc: add Authorization to Access-Control-Allow-Headers (#2018) (#2020)

This commit is contained in:
Alessandro Ros 2023-07-04 22:18:41 +02:00 committed by GitHub
parent 91ada9bf07
commit 64a715a663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -462,7 +462,7 @@ If you want to run the standard (non-Docker) version of the server:
The resulting stream will be available in path `/cam`.
If you want to run the server inside Docker, you need to use the `latest-rpi` image (that already contains libcamera) and launch the container with some additional flags:
If you want to run the server inside Docker, you need to use the `latest-rpi` image (that already contains required libraries) and launch the container with some additional flags:
```sh
docker run --rm -it \

View File

@ -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", "Range")
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Authorization, Range")
ctx.Writer.WriteHeader(http.StatusOK)
return

View File

@ -240,7 +240,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, POST, PATCH")
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, If-Match")
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, If-Match")
ctx.Writer.WriteHeader(http.StatusOK)
return
@ -336,7 +336,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, POST, PATCH")
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, If-Match")
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, If-Match")
ctx.Writer.Header()["Link"] = iceServersToLinkHeader(s.parent.generateICEServers())
ctx.Writer.WriteHeader(http.StatusOK)