Skip to content

Commit

Permalink
Merge pull request AlexxIT#798 from MPTres/cors
Browse files Browse the repository at this point in the history
Fix CORS support in WHEP/WHIP API
  • Loading branch information
AlexxIT authored Dec 5, 2023
2 parents 8d9f870 + 0da8b46 commit 39d8762
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func middlewareCORS(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Authorization")
w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type")
next.ServeHTTP(w, r)
})
}
Expand Down
3 changes: 3 additions & 0 deletions internal/webrtc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func syncHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, "", http.StatusBadRequest)
}

case "OPTIONS":
w.WriteHeader(http.StatusNoContent)

default:
http.Error(w, "", http.StatusMethodNotAllowed)
}
Expand Down

0 comments on commit 39d8762

Please sign in to comment.