summaryrefslogtreecommitdiff
path: root/system/api/handlers.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-01-13 11:58:39 -0800
committerSteve Manuel <nilslice@gmail.com>2017-01-13 11:58:39 -0800
commit59ee9fbb237673c2d0cccad42f7adbae65852b8d (patch)
tree3326e7c43eef2483fff5e24b7e2f840fb94b4d38 /system/api/handlers.go
parent3249b82b2a4f1aa0ae9e6943cd72dd7eebae8a4a (diff)
changing ConfigCache to return interface{}
Diffstat (limited to 'system/api/handlers.go')
-rw-r--r--system/api/handlers.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/system/api/handlers.go b/system/api/handlers.go
index 1bc4fbb..0be98a4 100644
--- a/system/api/handlers.go
+++ b/system/api/handlers.go
@@ -254,6 +254,12 @@ func sendPreflight(res http.ResponseWriter) {
// CORS wraps a HandleFunc to respond to OPTIONS requests properly
func CORS(next http.HandlerFunc) http.HandlerFunc {
+ if db.ConfigCache("cors_disabled").([]string)[0] == "true" {
+ return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
+ res.WriteHeader(http.StatusForbidden)
+ })
+ }
+
return db.CacheControl(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
if req.Method == http.MethodOptions {
sendPreflight(res)