Skip to content

Commit

Permalink
Add CORS ?
Browse files Browse the repository at this point in the history
  • Loading branch information
tsauvajon committed Jun 18, 2018
1 parent 335980f commit 627117e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -16,3 +16,6 @@ rapiquette

# Auto generated
bindata.go

# debug
ids.txt
6 changes: 6 additions & 0 deletions handler/handler.go
Expand Up @@ -21,6 +21,12 @@ func NewHandler(s *graphql.Schema, httpHandler http.Handler) http.HandlerFunc {
return
}
}
w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type")
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.Header().Set("X-Content-Type-Options", "nosniff")
w.WriteHeader(200)
httpHandler.ServeHTTP(w, r)
}
}
Expand Down

0 comments on commit 627117e

Please sign in to comment.