Merge pull request #327 from Dar13/add-cors-headers-public-api
Add CORS header ('Access-Control-Allow-Origin') to public APIs
This commit is contained in:
commit
f75d4cb75d
1 changed files with 3 additions and 0 deletions
|
@ -601,6 +601,9 @@ func (h *Handler) AllReader(f handlerFunc) http.HandlerFunc {
|
||||||
log.Info(h.app.ReqLog(r, status, time.Since(start)))
|
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 {
|
if h.app.App().cfg.App.Private {
|
||||||
// This instance is private, so ensure it's being accessed by a valid user
|
// This instance is private, so ensure it's being accessed by a valid user
|
||||||
// Check if authenticated with an access token
|
// Check if authenticated with an access token
|
||||||
|
|
Loading…
Add table
Reference in a new issue