summaryrefslogtreecommitdiff
path: root/system/admin/server.go
diff options
context:
space:
mode:
authorSteve <nilslice@gmail.com>2017-01-16 16:14:00 -0800
committerGitHub <noreply@github.com>2017-01-16 16:14:00 -0800
commit2af951230eddc45ba429cff10d7566ad98fd343b (patch)
tree7543be03fae8aeeacc8eb48dbe16ab2d42fbca0b /system/admin/server.go
parent3249b82b2a4f1aa0ae9e6943cd72dd7eebae8a4a (diff)
[core] Adding toggle for CORS, GZIP in admin/cms configuration (#30)
This PR enables admins to disable/enable CORS and GZIP from within the admin CMS configuration page. Both are enabled by default. Note: currently, the GZIP implementation is 100% on the fly, for every qualifying API endpoint request. This could add significant CPU usage, but dramatically decreases bandwidth. Will be considering other better implementations, but for now YMMV. Possible optimizations: - pooling gzip Writers vs. creating a new one for each response - caching gzipped responses (in memory? on disk?) - enforcing size threshold (only gzip content larger than N bytes)
Diffstat (limited to 'system/admin/server.go')
-rw-r--r--system/admin/server.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/system/admin/server.go b/system/admin/server.go
index f2bf244..11bfe6f 100644
--- a/system/admin/server.go
+++ b/system/admin/server.go
@@ -51,5 +51,5 @@ func Run() {
// even if the API server is not running. Otherwise, images/files uploaded
// through the editor will not load within the admin system.
uploadsDir := filepath.Join(pwd, "uploads")
- http.Handle("/api/uploads/", api.Record(db.CacheControl(http.StripPrefix("/api/uploads/", http.FileServer(restrict(http.Dir(uploadsDir)))))))
+ http.Handle("/api/uploads/", api.Record(api.CORS(db.CacheControl(http.StripPrefix("/api/uploads/", http.FileServer(restrict(http.Dir(uploadsDir))))))))
}