move cors to middleware (#54)

* move cors to middleware

* check for nil url

* remove snapshot
This commit is contained in:
David Colburn
2021-07-15 18:36:54 -05:00
committed by GitHub
parent 53bc65285c
commit e3fc3397ce
2 changed files with 17 additions and 14 deletions
+4
View File
@@ -34,6 +34,10 @@ func NewAPIKeyAuthMiddleware(provider auth.KeyProvider) *APIKeyAuthMiddleware {
}
func (m *APIKeyAuthMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
if r.URL != nil && r.URL.Path == "/rtc/validate" {
w.Header().Set("Access-Control-Allow-Origin", "*")
}
authHeader := r.Header.Get(authorizationHeader)
var authToken string