Skip to content

Commit

Permalink
Add CORS header ('Access-Control-Allow-Origin') to 'AllReader'
Browse files Browse the repository at this point in the history
Allows all API endpoints using 'AllReader' to be queryable by any
origin.
  • Loading branch information
Dar13 committed Jun 24, 2020
1 parent 5c94d23 commit 94bcb91
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ func (h *Handler) AllReader(f handlerFunc) http.HandlerFunc {
log.Info(h.app.ReqLog(r, status, time.Since(start)))
}()

// Allow any origin, as public endpoints are handled in here
w.Header().Set("Access-Control-Allow-Origin", "*");

if h.app.App().cfg.App.Private {
// This instance is private, so ensure it's being accessed by a valid user
// Check if authenticated with an access token
Expand Down

0 comments on commit 94bcb91

Please sign in to comment.