Skip to content

Commit

Permalink
set cors headers for /api/event
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Feb 11, 2024
1 parent 6728b5b commit 5d0108f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (

func ReceiveEvent(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-Content-Type-Options", "nosniff")
w.Header().Set("Access-Control-Allow-Origin", r.Header.Get("Origin"))
w.Header().Set("Access-Control-Allow-Methods", http.MethodPost)
w.Header().Add("Access-Control-Allow-Headers", "Content-Type")
ctx := r.Context()
xg := guard.Get(ctx)
if !xg.Allow() {
Expand Down

0 comments on commit 5d0108f

Please sign in to comment.