summaryrefslogtreecommitdiff
path: root/system/api/handlers.go
diff options
context:
space:
mode:
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)