diff options
Diffstat (limited to 'api/context.go')
-rw-r--r-- | api/context.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/api/context.go b/api/context.go index 9e05c5d87..3b9782851 100644 --- a/api/context.go +++ b/api/context.go @@ -166,6 +166,10 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // All api response bodies will be JSON formatted by default w.Header().Set("Content-Type", "application/json") + if len(utils.Cfg.ServiceSettings.AllowCorsFrom) > 0 { + w.Header().Set("Access-Control-Allow-Origin", utils.Cfg.ServiceSettings.AllowCorsFrom) + } + if r.Method == "GET" { w.Header().Set("Expires", "0") } |