The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/1706
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) ===
From 3d46c67d85c659633c38bc22ee90cf0a717036e3 Mon Sep 17 00:00:00 2001 From: Anthony ARNAUD <pe...@anthony-arnaud.fr> Date: Mon, 7 Mar 2016 00:12:20 +0100 Subject: [PATCH] #1705: Feature: Add headers CORS for use with web app --- lxd/daemon.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lxd/daemon.go b/lxd/daemon.go index 83a3686..caa0963 100644 --- a/lxd/daemon.go +++ b/lxd/daemon.go @@ -1134,6 +1134,10 @@ func (d *Daemon) ConfigKeyIsValid(key string) bool { return true case "core.https_allowed_origin": return true + case "core.https_allowed_methods": + return true + case "core.https_allowed_headers": + return true case "core.trust_password": return true case "storage.lvm_vg_name": @@ -1283,6 +1287,16 @@ func (s *lxdHttpServer) ServeHTTP(rw http.ResponseWriter, req *http.Request) { rw.Header().Set("Access-Control-Allow-Origin", allowedOrigin) } + allowedMethods, _ := s.d.ConfigValueGet("core.https_allowed_methods") + if allowedMethods != "" && origin != "" { + rw.Header().Set("Access-Control-Allow-Methods", allowedMethods) + } + + allowedHeaders, _ := s.d.ConfigValueGet("core.https_allowed_headers") + if allowedHeaders != "" && origin != "" { + rw.Header().Set("Access-Control-Allow-Headers", allowedHeaders) + } + // OPTIONS request don't need any further processing if req.Method == "OPTIONS" { return
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel